This is the API docs for LemonStand V1, which has been discontinued. LemonStand is now a cloud based platform, available at lemonstand.com.

LemonStand API

Cms_Page class

Defined in /modules/cms/models/cms_page.php, lines 13-2250
Inheritance Phpr_Extension » Phpr_Extensible » Phpr_Validatable » Db_Base » Db_WhereBase » Db_SqlBase » Db_ActiveRecord » Cms_Object » Cms_Page
Author LemonStand eCommerce Inc.
Represents a CMS page. Cms_Page class represents a front-end website page.

Public properties

Show inherited properties.

Property Type Description Defined By
auto_create_timestamps array a list of create timestamp columns. Db_ActiveRecord
auto_timestamps boolean determines whether create and update timestamp field should be set automatically. Db_ActiveRecord
auto_update_timestamps array a list of update timestamp columns. Db_ActiveRecord
content string contains the page content source code. Cms_Page
custom_columns array contains a list of custom fields definition. Db_ActiveRecord
description string contains the page description. Cms_Page
fetched array contains an associative array of table column values fetched from the database. Db_ActiveRecord
has_many array contains a list of Has Many relations. Db_ActiveRecord
has_one array contains a list of Has One relations. Db_ActiveRecord
id integer specifies the page identifier in the database. Cms_Page
is_published boolean determines whether the page is published. Cms_Page
keywords string contains the page keywords. Cms_Page
navigation_label string specifies the page navigation label for site maps and generated menus. Cms_Page
navigation_visible string determines whether the page is visible in the site maps and generated menus. Cms_Page
primary_key string specifies a name of the table primary key. Db_ActiveRecord
protocol string specifies a protocol the page can be accessed by. Cms_Page
title string specifies the page title. Cms_Page
url string specifies the page URL relative to the application root. Cms_Page
validation Phpr_Validation contains the model's validation object. Db_ActiveRecord

Public methods

Show inherited methods.

Method Description Defined By
add_form_custom_area() adds a form custom area. Db_ActiveRecord
add_form_field() makes a column visible in forms. Db_ActiveRecord
add_form_partial() adds a custom form partial. Db_ActiveRecord
add_form_section() adds a form section. Db_ActiveRecord
after_create_saved() called after a new object is saved to the database. Db_ActiveRecord
after_update() called after an existing record is updated in the database. Db_ActiveRecord
after_validation_on_create() triggered after a new model column values are validated. Db_ActiveRecord
after_validation_on_update() triggered after an existing model column values are validated. Db_ActiveRecord
before_create() called before a new object is saved to the database. Db_ActiveRecord
before_update() called before an existing record is updated in the database. Db_ActiveRecord
before_validation() triggered before the model column values are validated. Db_ActiveRecord
before_validation_on_create() triggered before a new model column values are validated. Db_ActiveRecord
before_validation_on_update() triggered before an existing model column values are validated. Db_ActiveRecord
collection() executes the find_all() method and returns a collection. Db_ActiveRecord
columnValue() alias for the displayField() method. Db_ActiveRecord
define_column() adds a column definition to the model. Db_ActiveRecord
define_multi_relation_column() adds column definition for has_and_belongs_to_many or has_many relation field. Db_ActiveRecord
define_relation_column() adds column definition for has_on or belongs_to relation field. Db_ActiveRecord
delete() deletes the record from the database. Db_ActiveRecord
delete_form_field() deletes a form field by its corresponding column name. Db_ActiveRecord
displayField() returns a formatted column value. The field should be defined with define_column(), Db_ActiveRecord
find() finds a record by its primary key value. Db_ActiveRecord
findByUrl() returns a page by its URL. Cms_Page
find_all() finds all records and returns the Db_DataCollection object, containing a list of models. Db_ActiveRecord
find_by() finds a record by a field value. Db_ActiveRecord
find_by_action_reference() finds a page by action name. Cms_Page
find_by_id() finds a page by its identifier. Cms_Page
find_column_definition() finds a column definition by the column name. Db_ActiveRecord
find_form_field() finds a form field definition by its corresponding column name. Db_ActiveRecord
get_ajax_handlers_code() returns the page AJAX handlers code string. Cms_Page
get_content_block_content() returns content of a content block content by its code. Cms_Page
get_content_code() returns the page content code string. Cms_Page
get_head_code() returns the page head declarations code string. Cms_Page
get_post_action_code() returns the POST action code string. Cms_Page
get_pre_action_code() returns the PRE action code string. Cms_Page
join() adds a table to the query with JOIN statement. Db_SqlBase
limit() allows to limit the result of the find_all() method with the specified number of records. Db_ActiveRecord
list_related_records_deferred() returns a list of relation objects, taking into account deferred relations. Db_ActiveRecord
navigation_label() returns the navigation menu label. Cms_Page
navigation_parents() returns a list of the page navigation parents. Cms_Page
navigation_root_pages() returns a list of navigation root pages. Cms_Page
navigation_subpages() returns a list of pages grouped under this page. Cms_Page
order() allows to order the result of the find_all() method by a specific table column. Db_SqlBase
orWhere() adds OR statement to the where clause, allowing to to limit the result of the find() and find_all() methods with SQL filter. Db_WhereBase
paginate() allows to limit the result of the find_all() method with a single page of records. Db_ActiveRecord
requestRowCount() returns a number of rows which would be returned with find_all() method. Db_ActiveRecord
save() saves record to the database. Db_ActiveRecord
visible_for_customer_group() determines whether the page is visible for a specific customer group. Cms_Page
where() allows to limit the result of the find() and find_all() methods with SQL filter. Db_WhereBase

Events

Event Description
cms:onAfterPageDuplicate Triggered after a page has been duplicated with Duplicate Theme feature.
cms:onCmsPageImport Triggered before a CMS page imported from a file is saved.
cms:onConfigurePagesPage Allows to configure the Administration Area CMS Pages pages before they are displayed.
cms:onDeletePage Triggered before a page is deleted.
cms:onDisplayPageForm Allows to load extra CSS or JavaScript files on the Created/Edit Page page.
cms:onExtendPageContentToolbar Allows to add new buttons to the toolbar above the Edit Content form (CMS/Pages/Edit page content) in the Administration Area.
cms:onExtendPageForm Allows to add new fields to the Create/Edit Page form.
cms:onExtendPageModel Allows to define new columns in the page model.
cms:onExtendPagesContextMenu Allows to add new items to the list context menu on the CMS/Pages page in the Administration Area.
cms:onExtendPagesToolbar Allows to add new buttons to the toolbar above the page list (CMS/Pages page) in the Administration Area.
cms:onGetPageBlockContent Allows to programmatically modify a content block content.
cms:onGetPageContent Allows to programmatically modify a page content.
cms:onGetPageFieldOptions Allows to populate drop-down, radio- or checkbox list fields, which have been added with cms:onExtendPageForm event.
cms:onGetPageNavigationVisibility Allows to hide a page from automatically generated menus and site maps.
cms:onListPageEditorSidebarTabs Allows to add tabs to the Create/Edit Page page sidebar in the Administration Area.
cms:onPreparePageListData Allows to alter the list of pages on the CMS/Pages page in the Administration Area.

Property details

content property

public string $content;
Contains the page content source code. Use get_content_code() method instead of accessing this property directly. The property reflects the database value, which can be not actual if the file-based templates mode is enabled.

description property

public string $description;
Contains the page description.

id property

public integer $id;
Specifies the page identifier in the database.

is_published property

public boolean $is_published;
Determines whether the page is published. Unpublished pages are not visible on the front-end website.

keywords property

public string $keywords;
Contains the page keywords.

navigation_label property

public string $navigation_label;
Specifies the page navigation label for site maps and generated menus.

navigation_visible property

public string $navigation_visible;
Determines whether the page is visible in the site maps and generated menus.

protocol property

public string $protocol;
Specifies a protocol the page can be accessed by. By default all pages can be accessed by any protocol. The propety accepts the following values:
  • any - HTTP or HTTPS protocol
  • http - HTTP only
  • https - HTTPS only
  • none - None - requests are always redirected to the page specified in the Redirect field.

title property

public string $title;
Specifies the page title.

url property

public string $url;
Specifies the page URL relative to the application root.

Method details

findByUrl() method

public static mixed findByUrl(string $url, array &$params)
$url string specifies the URL.
$params array a list of URL parameters. Represent parameters extracted from the URL. Pass an empty array to this parameter.
{return} mixed returns Cms_Page object if a page corresponding the URL was found. Otherwise returns NULL.
Returns a page by its URL. Resolves an URL and returns the page object corresponding that URL. Please note that the method finds pages in context of the currently active theme.
The following code example tries to find a page with URL /categories/computers. If there was a page with URL /categories it would be returned and the $params array would contain a single element computers:
$params = array();
$page = Cms_Page::findByUrl('/categories/computers', $params);

find_by_action_reference() method

public Cms_Page find_by_action_reference(string $action)
$action string specifies the action name.
{return} Cms_Page returns the page object. Returns NULL if the page was not found.
Finds a page by action name. This method allows to find a page which uses a specific action. Please note that the method finds pages in context of the currently active theme. The following example finds the product page:
$page = Cms_Page::find_by_action_reference('shop:product');

find_by_id() method

public static Cms_Page find_by_id(integer $id)
$id integer specifies the page identifier.
{return} Cms_Page returns the page object. Returns NULL if the page was not found.
Finds a page by its identifier. This method uses internal caching, and it is recommendable to use it instead of direct ActiveRecord calls/

get_ajax_handlers_code() method

public string get_ajax_handlers_code(boolean $remove_php_wrap=false)
$remove_php_wrap boolean determines if PHP open and close tags should be removed from result.
{return} string returns the page AJAX handlers code string.
Returns the page AJAX handlers code string This method loads the code string from a file if the file-based templates mode is enabled. If it is disabled, it returns the database field content.

get_content_block_content() method

public string get_content_block_content(string $code)
$code string specifies the content block code.
{return} string returns the content block content string.
Returns content of a content block content by its code. Behavior of this method can be affected by cms:onGetPageBlockContent event handler.

get_content_code() method

public string get_content_code()
{return} string returns the page content string.
Returns the page content code string This method loads the code string from a file if the file-based templates mode is enabled. If it is disabled, it returns the database field content. The result of this method can be affected by cms:onGetPageContent event.

get_head_code() method

public string get_head_code()
{return} string returns the page head declarations code string.
Returns the page head declarations code string This method loads the code string from a file if the file-based templates mode is enabled. If it is disabled, it returns the database field content.

get_post_action_code() method

public string get_post_action_code(boolean $remove_php_wrap=false)
$remove_php_wrap boolean determines if PHP open and close tags should be removed from result.
{return} string returns the POST action code string.
Returns the POST action code string. This method loads the code string from a file if the file-based templates mode is enabled. If it is disabled, it returns the database field content.

get_pre_action_code() method

public string get_pre_action_code(boolean $remove_php_wrap=false)
$remove_php_wrap boolean determines if PHP open and close tags should be removed from result.
{return} string returns the PRE action code string.
Returns the PRE action code string. This method loads the code string from a file if the file-based templates mode is enabled. If it is disabled, it returns the database field content.

navigation_label() method

public string navigation_label()
{return} string returns the page navigation menu label or page title.
Returns the navigation menu label. If the navigation menu label was not specified for this page, the function returns the page title.

navigation_parents() method

public array navigation_parents(boolean $include_this=true)
$include_this boolean determines whether the current page should be included to the result.
{return} array returns an array of the Cms_PageNavigationNode objects.
Returns a list of the page navigation parents. You can use this method for generating bread crumb navigation.

navigation_root_pages() method

public static array navigation_root_pages()
{return} array returns an array of the Cms_PageNavigationNode objects
Returns a list of navigation root pages.

navigation_subpages() method

public array navigation_subpages()
{return} array returns an array of the Cms_PageNavigationNode objects
Returns a list of pages grouped under this page.

visible_for_customer_group() method

public boolean visible_for_customer_group(integer $group_id)
$group_id integer specifies the customer group identifier.
{return} boolean returns TRUE if the page is visible for the customer group. Returns FALSE otherwise.
Determines whether the page is visible for a specific customer group.