[FEATURE] Registers for title & alt text fields in file links 05/17705/3
authorGeorg Ringer <georg.ringer@gmail.com>
Fri, 25 Jan 2013 14:06:39 +0000 (15:06 +0100)
committerGeorg Ringer <georg.ringer@gmail.com>
Thu, 18 Jul 2013 06:11:54 +0000 (08:11 +0200)
The file link element offers a description, title text and alternative
label text for each file.
Currently, it is only possible to access the description via a register.
It would be desirable to also provide registers for the alt and title
text fields, e.g., to only link the description and provide more
in-depth info in the other fields.

Change-Id: I7860a769e957c83691e48090ea1bbc94c9ebf9df
Resolves: #44182
Releases: 6.2
Reviewed-on: https://review.typo3.org/17705
Reviewed-by: Alexander Opitz
Reviewed-by: Georg Ringer
Tested-by: Georg Ringer
typo3/sysext/css_styled_content/Classes/Controller/CssStyledContentController.php

index e318a79..746eb49 100644 (file)
@@ -314,6 +314,8 @@ class CssStyledContentController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlug
                                                $filesData[$key]['filesize'] = filesize($absPath);
                                                $filesData[$key]['fileextension'] = strtolower($fI['extension']);
                                                $filesData[$key]['description'] = trim($descriptions[$key]);
+                                               $filesData[$key]['titletext'] = trim($titles[$key]);
+                                               $filesData[$key]['alttext'] = trim($altTexts[$key]);
                                                $conf['linkProc.']['title'] = trim($titles[$key]);
                                                if (isset($altTexts[$key]) && !empty($altTexts[$key])) {
                                                        $altText = trim($altTexts[$key]);
@@ -328,6 +330,9 @@ class CssStyledContentController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlug
                                                $GLOBALS['TSFE']->register['fileSize'] = $filesData[$key]['filesize'];
                                                $GLOBALS['TSFE']->register['fileExtension'] = $filesData[$key]['fileextension'];
                                                $GLOBALS['TSFE']->register['description'] = $filesData[$key]['description'];
+                                               $GLOBALS['TSFE']->register['titleText'] = $filesData[$key]['titletext'];
+                                               $GLOBALS['TSFE']->register['altText'] = $filesData[$key]['alttext'];
+
                                                $filesData[$key]['linkedFilenameParts'] = $this->beautifyFileLink(
                                                        explode('//**//', $this->cObj->filelink($fileName, $conf['linkProc.'])),
                                                        $fileName,
@@ -348,6 +353,8 @@ class CssStyledContentController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlug
                                        $GLOBALS['TSFE']->register['description'] = $fileData['description'];
                                        $GLOBALS['TSFE']->register['fileSize'] = $fileData['filesize'];
                                        $GLOBALS['TSFE']->register['fileExtension'] = $fileData['fileextension'];
+                                       $GLOBALS['TSFE']->register['titleText'] = $fileData['titletext'];
+                                       $GLOBALS['TSFE']->register['altText'] = $fileData['alttext'];
                                        $outputEntries[] = $this->cObj->cObjGetSingle($splitConf[$key]['itemRendering'], $splitConf[$key]['itemRendering.']);
                                }
                                if (isset($conf['outerWrap'])) {