LemonStand Documentation

cms:onDeletePartial event

The cms:onDeletePartial event is triggered when somebody deletes a partial in the Administration Area. The event handler should accept a single parameter - the partial object (Cms_Partial 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:onDeletePartial', $this, 'partial_deletion_check');
}
 
public function partial_deletion_check($partial)
{
  if ($partial->name == 'test')
    throw new Phpr_ApplicationException("You cannot delete this partial!");
}

Next: cms:onDeleteTemplate event
Previous: cms:onExtendTemplatesToolbar event
Return to Handling LemonStand events