LemonStand Documentation

cms:onDeleteTemplate event

The cms:onDeleteTemplate event is triggered when somebody deletes a template in the Administration Area. The event handler should accept a single parameter - the partial object (Cms_Template class instance). You can throw an exception in the handler code to prevent deletion of a specific template.

Event handler example:

public function subscribeEvents()
{
  Backend::$events->addEvent('cms:onDeleteTemplate', $this, 'template_deletion_check');
}
 
public function template_deletion_check($template)
{
  if ($template->name == 'test')
    throw new Phpr_ApplicationException("You cannot delete this template!");
}

Next: cms:onGetActiveTheme event
Previous: cms:onDeletePartial event
Return to Handling LemonStand events