cms:onExtendPageModel event
This event allows you to define new fields in the CMS page model. The event handler should accept two parameters - the page object (Cms_Page) and the form execution context string. To add new columns to the page model, please call the define_column() method of the page object. Before you add new columns to the model, you should add them to the database (the pages table). Please read the Extending existing models article to learn more about extending existing models.
Example of the event handler:
public function subscribeEvents()
{
Backend::$events->addEvent('cms:onExtendPageModel', $this, 'extend_page_model');
Backend::$events->addEvent('cms:onExtendPageForm', $this, 'extend_page_form');
}
public function extend_page_model($page, $context)
{
$page->define_column('x_extra_description', 'Extra description');
}
public function extend_page_form($page, $context)
{
if ($context != 'content')
$page->add_form_field('x_extra_description')->tab('Description');
}
Next: cms:onExtendTemplateModel event
Previous: onDeleteEmailTemplate event
Return to Handling LemonStand events

