/** * @param $name * @return IItem|null */ protected function loadModel($name) { list($table, $id, $providerId) = explode('::', $name, 3); if ($providerId != $this->providerId) { // prevent that item for which this provider is not responsible will handle the model return null; } if (isset(static::$cache[$name])) { return static::$cache[$name]; } if ($table != $this->metaModel->getTableName()) { return null; } return $this->metaModel->findById($id); }
/** * Check if the item is published. * * @param IMetaModel $objMetaModel Current metamodels. * @param int $intItemId Id of the item. * * @return boolean True => Published | False => Not published */ protected function isPublishedItem($objMetaModel, $intItemId) { // Check publish state of an item. $objAttrCheckPublish = $this->getServiceContainer()->getDatabase()->prepare('SELECT colname FROM tl_metamodel_attribute WHERE pid=? AND check_publish=1')->limit(1)->execute($objMetaModel->get('id')); if ($objAttrCheckPublish->numRows > 0) { $objItem = $objMetaModel->findById($intItemId); if (!$objItem->get($objAttrCheckPublish->colname)) { return false; } } return true; }