/** * Render different label for media elements * * @param array $params configuration * @return void */ public function getUserLabelMedia(array &$params) { $ll = 'LLL:EXT:news/Resources/Private/Language/locallang_db.xml:'; $title = $typeInfo = $additionalHtmlContent = ''; $type = $GLOBALS['LANG']->sL($ll . 'tx_news_domain_model_media.type.I.' . $params['row']['type']); // Add additional info based on type switch ((int) $params['row']['type']) { // Image case Tx_News_Domain_Model_Media::MEDIA_TYPE_IMAGE: $typeInfo .= $this->getTitleFromFields('title,alt,caption,image', $params['row']); if (!empty($params['row']['image'])) { $params['row']['image'] = $this->splitFileName($params['row']['image']); $additionalHtmlContent = '<br />' . t3lib_BEfunc::thumbCode($params['row'], 'tx_news_domain_model_media', 'image', $GLOBALS['BACK_PATH'], '', NULL, 0, '', '', FALSE); } break; // Audio & Video // Audio & Video case Tx_News_Domain_Model_Media::MEDIA_TYPE_MULTIMEDIA: $typeInfo .= $this->getTitleFromFields('caption,multimedia', $params['row']); break; // HTML // HTML case Tx_News_Domain_Model_Media::MEDIA_TYPE_HTML: // Don't show html value as this could get a XSS $typeInfo .= $params['row']['caption']; break; // DAM // DAM case Tx_News_Domain_Model_Media::MEDIA_TYPE_DAM: if (intval($params['row']['uid']) > 0) { $config = $GLOBALS['TCA'][$params['table']]['columns']['dam']['config']; $damItems = tx_dam_db::getReferencedFiles($params['table'], $params['row']['uid'], $config['MM_match_fields'], $config['MM'], 'tx_dam.*'); if (is_array($damItems['rows'])) { $item = array_shift($damItems['rows']); $typeInfo = $this->getTitleFromFields('title,file_name', $item); } } break; default: $typeInfo .= $params['row']['caption']; } $title = !empty($typeInfo) ? $type . ': ' . $typeInfo : $type; $title = htmlspecialchars($title) . $additionalHtmlContent; // Hook to modify the label, especially useful when using custom media relations if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXT']['news']['mediaLabel'])) { $params = array('params' => $params, 'title' => $title); foreach ($GLOBALS['TYPO3_CONF_VARS']['EXT']['news']['mediaLabel'] as $reference) { $title = t3lib_div::callUserFunction($reference, $params, $this); } } // Preview if ($params['row']['showinpreview']) { $label = htmlspecialchars($GLOBALS['LANG']->sL($ll . 'tx_news_domain_model_media.show')); $icon = '../' . t3lib_extMgm::siteRelPath('news') . 'Resources/Public/Icons/preview.gif'; $title .= ' <img title="' . $label . '" src="' . $icon . '" />'; } // Show the [No title] if empty if (empty($title)) { $title = t3lib_befunc::getNoRecordTitle(TRUE); } $params['title'] = $title; }