LemonStand Documentation

cms:onExtendPageForm event

This event allows to add new fields to the Create/Edit Page form in the Administration Area. Usually this event is used together with the cms:onExtendPageModel event. The event handler should accept two parameters - the page object (Cms_Page) and the form execution context string. To add new fields to the page form, please call the add_form_field() method of the page object. Please read the Extending existing models article to learn more about extending LemonStand 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: shop:onGetCustomerFieldOptions event
Previous: cms:onBeforeDisplay event
Return to Handling LemonStand events