CmsPages extends CmsModel
CMS Pages
Manages CMS pages
Table of Contents
Properties
| $parse_error |
Methods
| __construct() | Initialize |
| add() | Adds a new CMS page |
| delete() | Removes a CMS page with the given URI and all of its language variants |
| edit() | Edits a CMS page |
| get() | Fetches a page at the given URI |
| getAll() | Returns a list of all pages of the current company. Returns only one language, for all languages use CmsPages::getAllLang() |
| getAllLang() | Fetches a page with all of its languages |
| getContentTypes() | Returns all valid content types |
| getLang() | Fetches a page at the given URI with the specific language |
| getList() | Returns a list of pages for the current company |
| getListCount() | Returns the total number of pages for the current company |
| validateUnique() | Validates if the given URI and Lang combination is unique (does not exist in the database) |
| getRules() | Retrieves a list of input rules for adding a CMS page |
| setParseError() | Sets the parse error in the set of errors |
Methods
__construct()
Initialize
public
__construct() : mixed
add()
Adds a new CMS page
public
add(array<string|int, mixed> $vars) : mixed
Parameters
- $vars : array<string|int, mixed>
-
A list of input vars for creating a CMS page, including:
- uri The URI of the page
- lang The language of the page
- title The page title
- content The page content
- content_type The type of the page content
delete()
Removes a CMS page with the given URI and all of its language variants
public
delete(string $uri) : mixed
Parameters
- $uri : string
-
The URI of the CMS page to remove
edit()
Edits a CMS page
public
edit(string $uri, string $lang, array<string|int, mixed> $vars) : mixed
Parameters
- $uri : string
-
The URI of the page to edit
- $lang : string
-
The language of the page to edit
- $vars : array<string|int, mixed>
-
A list of input vars for editing a CMS page, including:
- uri The URI of the page
- title The page title
- content The page content
- content_type The type of the page content
get()
Fetches a page at the given URI
public
get(string $uri[, string $lang = null ]) : mixed
Parameters
- $uri : string
-
The URI of the page
- $lang : string = null
-
The language of the page
Return values
mixed —An stdClass object representing the CMS page, or false if none exist
getAll()
Returns a list of all pages of the current company. Returns only one language, for all languages use CmsPages::getAllLang()
public
getAll() : array<string|int, mixed>
Return values
array<string|int, mixed> —An stdClass array of objects representing CMS pages for the given company
getAllLang()
Fetches a page with all of its languages
public
getAllLang(string $uri) : mixed
Parameters
- $uri : string
-
The URI of the page
Return values
mixed —An stdClass object representing the CMS page, or false if none exist
getContentTypes()
Returns all valid content types
public
getContentTypes() : array<string|int, mixed>
Return values
array<string|int, mixed> —A keyed array of content types
getLang()
Fetches a page at the given URI with the specific language
public
getLang(string $uri, string $lang) : mixed
Parameters
- $uri : string
-
The URI of the page
- $lang : string
-
The language of the page
Return values
mixed —An stdClass object representing the CMS page, or false if none exist
getList()
Returns a list of pages for the current company
public
getList([int $page = 1 ][, array<string|int, mixed> $order = ['uri' => 'desc'] ]) : array<string|int, mixed>
Parameters
- $page : int = 1
-
The page number of results to fetch
- $order : array<string|int, mixed> = ['uri' => 'desc']
-
A key/value pair array of fields to order the results by
Return values
array<string|int, mixed> —An stdClass array of objects representing CMS pages for the given company
getListCount()
Returns the total number of pages for the current company
public
getListCount() : int
Return values
int —The total number of CMS pages for the current company
validateUnique()
Validates if the given URI and Lang combination is unique (does not exist in the database)
public
validateUnique(mixed $uri, mixed $lang) : mixed
Parameters
- $uri : mixed
-
The URI of the page
- $lang : mixed
-
The language of the page
getRules()
Retrieves a list of input rules for adding a CMS page
private
getRules(array<string|int, mixed> $vars[, bool $edit = false ]) : array<string|int, mixed>
Parameters
- $vars : array<string|int, mixed>
-
A list of input vars
- $edit : bool = false
-
True if a record is being edited, false otherwise
Return values
array<string|int, mixed> —A list of input rules
setParseError()
Sets the parse error in the set of errors
private
setParseError() : mixed