Allows to define new columns in the page model.
The event handler should accept two parameters - the page object and the form execution context string.
To add new columns to the page model, 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).
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');
}