/** * Get an item. * * @param string|int $metaModelIdOrName ID or name of MetaModels. * * @param string|int $mixDataId ID of the data row. * * @param int $intIdRenderSetting ID of render setting. * * @param string $strOutput Name of output. Default:null (fallback to htmlfynf)|text|html5|xhtml|... * * @return boolean|string Return false when nothing was found or return the value. */ protected function getItem($metaModelIdOrName, $mixDataId, $intIdRenderSetting, $strOutput = null) { // Get the MetaModel. Return if we can not find one. $objMetaModel = $this->loadMetaModel($metaModelIdOrName); if ($objMetaModel == null) { return false; } // Set output to default if not set. if (empty($strOutput)) { $strOutput = 'html5'; } $objMetaModelList = new ItemList(); $objMetaModelList->setServiceContainer($this->getServiceContainer())->setMetaModel($objMetaModel->get('id'), $intIdRenderSetting)->overrideOutputFormat($strOutput); // Handle a set of ids. $arrIds = trimsplit(',', $mixDataId); // Check each id if published. foreach ($arrIds as $intKey => $intId) { if (!$this->isPublishedItem($objMetaModel, $intId)) { unset($arrIds[$intKey]); } } // Render an empty insert tag rather than displaying a list with an empty. // result information. do not return false here because the insert tag itself is correct. if (count($arrIds) < 1) { return ''; } $objMetaModelList->addFilterRule(new StaticIdList($arrIds)); return $objMetaModelList->render(false, $this); }