Beispiel #1
0
 /**
  * Получает доступные типы контента
  *
  * @param      $aFilter
  * @param null $aAllowData
  *
  * @return array
  */
 public function getContentTypes($aFilter, $aAllowData = null)
 {
     if (is_null($aAllowData)) {
         $aAllowData = $this->aAdditionalDataContentType;
     }
     $sCacheKey = 'content_types_' . serialize(array($aFilter, $aAllowData));
     if (false === ($data = E::ModuleCache()->Get($sCacheKey, 'tmp,'))) {
         $data = $this->oMapper->getContentTypes($aFilter);
         $aTypesId = array();
         foreach ($data as $oType) {
             $aTypesId[] = $oType->getContentId();
         }
         if (isset($aAllowData['fields'])) {
             $aTopicFieldValues = $this->GetFieldsByArrayId($aTypesId);
         }
         foreach ($data as $oType) {
             if (isset($aTopicFieldValues[$oType->getContentId()])) {
                 $oType->setFields($aTopicFieldValues[$oType->getContentId()]);
             }
         }
         E::ModuleCache()->Set($data, $sCacheKey, array('content_update', 'content_new'), 'P1D', 'tmp,');
     }
     return $data;
 }