database_functions.php
Table of Contents
Functions
- get_all_pages() : array<string|int, mixed>
- Get all Brand Guidelines pages
- get_page_contents() : array<string|int, mixed>
- Get a Brand Guidelines page (entire) content
- get_page_content_item() : array<string|int, mixed>
- Get a specific page content item
- create_page() : int
- Create new Brand Guidelines page/section.
- save_page() : void
- Edit Brand Guidelines page/section.
- delete_pages() : bool
- Delete Brand Guidelines pages
- reorder_items() : void
- Re-order databse records (where order_by exists)
- create_content_item() : int
- Create new database record for a content item
- save_content_item() : bool
- Save a content item database record
- delete_page_content() : bool
- Delete a Brand Guideline page content
Functions
get_all_pages()
Get all Brand Guidelines pages
get_all_pages() : array<string|int, mixed>
Return values
array<string|int, mixed>get_page_contents()
Get a Brand Guidelines page (entire) content
get_page_contents(int $id) : array<string|int, mixed>
Parameters
- $id : int
Return values
array<string|int, mixed>get_page_content_item()
Get a specific page content item
get_page_content_item(int $id) : array<string|int, mixed>
Parameters
- $id : int
Return values
array<string|int, mixed>create_page()
Create new Brand Guidelines page/section.
create_page(string $name, int $parent) : int
Parameters
- $name : string
-
Page/Section name
- $parent : int
-
The sections' ID a page belongs to. Use zero for sections (i.e. root pages)
Return values
intsave_page()
Edit Brand Guidelines page/section.
save_page(int $ref, string $name, int $parent) : void
Parameters
- $ref : int
-
Page ID
- $name : string
-
Page name
- $parent : int
-
The sections' ID a page belongs to. Use zero for sections (i.e. root pages)
delete_pages()
Delete Brand Guidelines pages
delete_pages(array<int, int> $refs) : bool
Parameters
- $refs : array<int, int>
-
List of page IDs
Return values
bool —True if it executed the query, false otherwise
reorder_items()
Re-order databse records (where order_by exists)
reorder_items(string $table, array<string|int, mixed> $list, null|callable $filter) : void
Parameters
- $table : string
-
Database table (where the operation takes place)
- $list : array<string|int, mixed>
- $filter : null|callable
-
Optional filter, if the $list has unnecessary elements
create_content_item()
Create new database record for a content item
create_content_item(int $page, BRAND_GUIDELINES_CONTENT_TYPES, fields: array, position_after: int} $item) : int
Parameters
- $page : int
-
The page ID the content item belongs to
- $item : BRAND_GUIDELINES_CONTENT_TYPES, fields: array, position_after: int}
-
A content item data structure
Return values
int —Returns the ID of the new database record or zero otherwise.
save_content_item()
Save a content item database record
save_content_item(int $ref, array<string|int, mixed> $item) : bool
Parameters
- $ref : int
-
The content item ID
- $item : array<string|int, mixed>
Return values
booldelete_page_content()
Delete a Brand Guideline page content
delete_page_content(array<int, int> $refs) : bool
Parameters
- $refs : array<int, int>
-
List of page content IDs
Return values
bool —True if it executed the query, false otherwise