/** * Only add new items to the index if they have a frontend link * * @param KControllerContextInterface $context */ protected function _afterAdd(KControllerContextInterface $context) { $name = $this->getMixer()->getIdentifier()->name; if ($name === $this->_entity && $this->getModel()->findPage($context->result)) { parent::_afterAdd($context); } }
/** * Only add new items to the index if they have a frontend link * * @param KControllerContextInterface $context */ protected function _afterAdd(KControllerContextInterface $context) { $name = $context->result->getIdentifier()->name; // Get a new model since we are going to change the state and it would reset the cached entity $model = $this->getObject('com://admin/docman.model.documents'); if ($name === $this->_entity && $model->page('all')->findPage($context->result)) { parent::_afterAdd($context); } }