/** * Overrides modElement::remove to add custom error logging. * * {@inheritdoc} */ public function remove(array $ancestors = array()) { if ($this->xpdo instanceof modX) { $this->xpdo->invokeEvent('OnTemplateBeforeRemove', array('template' => &$this, 'ancestors' => $ancestors)); } $removed = parent::remove($ancestors); if ($removed && $this->xpdo instanceof modX) { $this->xpdo->invokeEvent('OnTemplateRemove', array('template' => &$this, 'ancestors' => $ancestors)); } else { if (!$removed && !empty($this->xpdo->lexicon)) { $this->xpdo->log(xPDO::LOG_LEVEL_ERROR, $this->xpdo->lexicon('template_err_remove') . $this->toArray()); } } return $removed; }