/** * Delete a template and unset it from this object. * */ public function ___delete(Saveable $item) { $cnt = $item->getNumPages(); if ($cnt > 0) { throw new WireException("Can't delete template '{$item->name}' because it is used by {$cnt} pages."); } return parent::___delete($item); }
/** * Delete a template and unset it from this object. * */ public function ___delete(Saveable $item) { if ($item->flags & Template::flagSystem) { throw new WireException("Can't delete template '{$item->name}' because it is a system template."); } $cnt = $item->getNumPages(); if ($cnt > 0) { throw new WireException("Can't delete template '{$item->name}' because it is used by {$cnt} pages."); } $return = parent::___delete($item); $this->wire('cache')->maintenance($item); return $return; }