コード例 #1
0
 /**
  * {@inheritDoc}
  */
 protected function prepareTemplate(Template $objTemplate, $arrRowData, $objSettings)
 {
     parent::prepareTemplate($objTemplate, $arrRowData, $objSettings);
     $objTemplate->value = $this->getCountryLabel($arrRowData[$this->getColName()]);
 }
コード例 #2
0
ファイル: File.php プロジェクト: metamodels/attribute_file
 /**
  * {@inheritDoc}
  */
 protected function prepareTemplate(Template $objTemplate, $arrRowData, $objSettings)
 {
     parent::prepareTemplate($objTemplate, $arrRowData, $objSettings);
     $objToolbox = new ToolboxFile();
     $objToolbox->setBaseLanguage($this->getMetaModel()->getActiveLanguage());
     $objToolbox->setFallbackLanguage($this->getMetaModel()->getFallbackLanguage());
     $objToolbox->setLightboxId(sprintf('%s.%s.%s', $this->getMetaModel()->getTableName(), $objSettings->get('id'), $arrRowData['id']));
     if (strlen($this->get('file_validFileTypes'))) {
         $objToolbox->setAcceptedExtensions($this->get('file_validFileTypes'));
     }
     $objToolbox->setShowImages($objSettings->get('file_showImage'));
     if ($objSettings->get('file_imageSize')) {
         $objToolbox->setResizeImages($objSettings->get('file_imageSize'));
     }
     if ($arrRowData[$this->getColName()]) {
         $value = $arrRowData[$this->getColName()];
         if (isset($value['value'])) {
             foreach ($value['value'] as $strFile) {
                 $objToolbox->addPathById($strFile);
             }
         } elseif (is_array($value)) {
             foreach ($value as $strFile) {
                 $objToolbox->addPathById($strFile);
             }
         } else {
             $objToolbox->addPathById($value);
         }
     }
     $objToolbox->resolveFiles();
     $arrData = $objToolbox->sortFiles($objSettings->get('file_sortBy'));
     $objTemplate->files = $arrData['files'];
     $objTemplate->src = $arrData['source'];
 }