Allows to add new fields to the Create/Edit Page form.
Usually this event is used together with the
cms:onExtendPageModel event.
The event handler should accept two parameters - the page object and the form execution context string.
To add new fields to the page form, call the
add_form_field() method of
the page object.
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');
}