From: Stanislas Rolland Date: Thu, 3 May 2012 03:03:38 +0000 (-0400) Subject: [FEATURE] Use FAL file properties as default image attributes in RTE X-Git-Tag: TYPO3_6-0-0alpha1~120 X-Git-Url: http://git.typo3.org/Packages/TYPO3.CMS.git/commitdiff_plain/5c6fdc476703ff7c42606079e325eb799ca3f2c3 [FEATURE] Use FAL file properties as default image attributes in RTE Use FAL file properties "name" and "alternative" as default values for "title" and "alt" img tag attributes when inserting an image into the RTE content. Change-Id: If33bfbd26bea5e63e154cd4e042b327eb1e02199 Releases: 6.0 Resolves: #36796 Reviewed-on: http://review.typo3.org/10944 Reviewed-by: Stanislas Rolland Tested-by: Stanislas Rolland --- diff --git a/typo3/sysext/rtehtmlarea/mod4/class.tx_rtehtmlarea_select_image.php b/typo3/sysext/rtehtmlarea/mod4/class.tx_rtehtmlarea_select_image.php index b8d093c93d20..ec8d6a0974b3 100644 --- a/typo3/sysext/rtehtmlarea/mod4/class.tx_rtehtmlarea_select_image.php +++ b/typo3/sysext/rtehtmlarea/mod4/class.tx_rtehtmlarea_select_image.php @@ -248,14 +248,16 @@ class tx_rtehtmlarea_select_image extends browse_links { $table = t3lib_div::_GP('table'); $uid = t3lib_div::_GP('uid'); $fileObject = t3lib_file_Factory::getInstance()->getFileObject($uid); - + // Get default values for alt and title attributes from file properties + $altText = $fileObject->getProperty('alternative'); + $titleText = $fileObject->getProperty('name'); switch ($this->act) { case 'magic': - $this->insertMagicImage($fileObject, '', '', 'data-htmlarea-file-uid="' . $uid . '" data-htmlarea-file-table="' . $table . '"'); + $this->insertMagicImage($fileObject, $altText, $titleText, 'data-htmlarea-file-uid="' . $uid . '" data-htmlarea-file-table="' . $table . '"'); exit; break; case 'plain': - $this->insertPlainImage($fileObject, '', '', 'data-htmlarea-file-uid="' . $uid . '" data-htmlarea-file-table="' . $table . '"'); + $this->insertPlainImage($fileObject, $altText, $titleText, 'data-htmlarea-file-uid="' . $uid . '" data-htmlarea-file-table="' . $table . '"'); exit; break; default: @@ -281,6 +283,7 @@ class tx_rtehtmlarea_select_image extends browse_links { */ public function insertMagicImage(t3lib_file_FileInterface $fileObject, $altText='', $titleText='', $additionalParams='') { if ($this->RTEImageStorageDir) { + // Create the magic image /** @var $magicImageService t3lib_file_Service_MagicImageService */ $magicImageService = t3lib_div::makeInstance('t3lib_file_Service_MagicImageService'); $imageConfiguration = array(