[BUGFIX] Make headerThumbnail in IRRE records configurable
authorKai Vogel <kai.vogel@speedprogs.de>
Sat, 10 Nov 2012 13:51:28 +0000 (14:51 +0100)
committerOliver Hader <oliver.hader@typo3.org>
Tue, 20 Nov 2012 23:22:03 +0000 (00:22 +0100)
This patch allows the configuration of the thumbnail image in IRRE
record headers. It is possible to configure e.g. height and width
using the TCA configuration in "headerThumbnail".

Resolves: #42837
Releases: 6.0

Change-Id: I284e9d04676fb3d4031eac6d2f8548761e167e69
Reviewed-on: http://review.typo3.org/16377
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader
typo3/sysext/backend/Classes/Form/Element/InlineElement.php
typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php

index 0fc7dee..d9361de 100644 (file)
@@ -538,15 +538,18 @@ class InlineElement {
                        $recTitle = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle($foreign_table, $rec, TRUE);
                }
                // Renders a thumbnail for the header
                        $recTitle = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle($foreign_table, $rec, TRUE);
                }
                // Renders a thumbnail for the header
-               if (!empty($config['appearance']['headerThumbnail'])) {
+               if (!empty($config['appearance']['headerThumbnail']['field'])) {
                        $originalRecord = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord($foreign_table, $rec['uid']);
                        if (is_array($originalRecord)) {
                        $originalRecord = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord($foreign_table, $rec['uid']);
                        if (is_array($originalRecord)) {
-                               $fileUid = $originalRecord[$config['appearance']['headerThumbnail']];
+                               $fileUid = $originalRecord[$config['appearance']['headerThumbnail']['field']];
                                list($fileUid) = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $fileUid);
                                if ($fileUid) {
                                        $fileObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->getFileObject($fileUid);
                                        if ($fileObject) {
                                list($fileUid) = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $fileUid);
                                if ($fileUid) {
                                        $fileObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->getFileObject($fileUid);
                                        if ($fileObject) {
-                                               $imageUrl = $fileObject->process(\TYPO3\CMS\Core\Resource\ProcessedFile::CONTEXT_IMAGEPREVIEW, array('width' => 64, 'height' => 64))->getPublicUrl(TRUE);
+                                               $imageSetup = $config['appearance']['headerThumbnail'];
+                                               unset($imageSetup['field']);
+                                               $imageSetup = array_merge(array('width' => 64, 'height' => 64), $imageSetup);
+                                               $imageUrl = $fileObject->process(\TYPO3\CMS\Core\Resource\ProcessedFile::CONTEXT_IMAGEPREVIEW, $imageSetup)->getPublicUrl(TRUE);
                                                $thumbnail = '<img src="' . $imageUrl . '" alt="' . htmlspecialchars($recTitle) . '">';
                                        } else {
                                                $thumbnail = FALSE;
                                                $thumbnail = '<img src="' . $imageUrl . '" alt="' . htmlspecialchars($recTitle) . '">';
                                        } else {
                                                $thumbnail = FALSE;
@@ -558,7 +561,7 @@ class InlineElement {
                $iconImg = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord($foreign_table, $rec, array('title' => htmlspecialchars($altText), 'id' => $objectId . '_icon'));
                $label = '<span id="' . $objectId . '_label">' . $recTitle . '</span>';
                $ctrl = $this->renderForeignRecordHeaderControl($parentUid, $foreign_table, $rec, $config, $isVirtualRecord);
                $iconImg = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord($foreign_table, $rec, array('title' => htmlspecialchars($altText), 'id' => $objectId . '_icon'));
                $label = '<span id="' . $objectId . '_label">' . $recTitle . '</span>';
                $ctrl = $this->renderForeignRecordHeaderControl($parentUid, $foreign_table, $rec, $config, $isVirtualRecord);
-               $header = '<table>' . '<tr>' . (!empty($config['appearance']['headerThumbnail']) && $thumbnail ? '<td class="t3-form-field-header-inline-thumbnail" id="' . $objectId . '_thumbnailcontainer">' . $thumbnail . '</td>' : '<td class="t3-form-field-header-inline-icon" id="' . $objectId . '_iconcontainer">' . $iconImg . '</td>') . '<td class="t3-form-field-header-inline-summary">' . $label . '</td>' . '<td clasS="t3-form-field-header-inline-ctrl">' . $ctrl . '</td>' . '</tr>' . '</table>';
+               $header = '<table>' . '<tr>' . (!empty($config['appearance']['headerThumbnail']['field']) && $thumbnail ? '<td class="t3-form-field-header-inline-thumbnail" id="' . $objectId . '_thumbnailcontainer">' . $thumbnail . '</td>' : '<td class="t3-form-field-header-inline-icon" id="' . $objectId . '_iconcontainer">' . $iconImg . '</td>') . '<td class="t3-form-field-header-inline-summary">' . $label . '</td>' . '<td clasS="t3-form-field-header-inline-ctrl">' . $ctrl . '</td>' . '</tr>' . '</table>';
                return $header;
        }
 
                return $header;
        }
 
index 04e2834..9ee4629 100644 (file)
@@ -479,7 +479,11 @@ class ExtensionManagementUtility {
                        ),
                        'appearance' => array(
                                'useSortable' => TRUE,
                        ),
                        'appearance' => array(
                                'useSortable' => TRUE,
-                               'headerThumbnail' => 'uid_local',
+                               'headerThumbnail' => array(
+                                       'field' => 'uid_local',
+                                       'width' => '64',
+                                       'height' => '64',
+                               ),
                                'showPossibleLocalizationRecords' => TRUE,
                                'showRemovedLocalizationRecords' => TRUE,
                                'showSynchronizationLink' => TRUE,
                                'showPossibleLocalizationRecords' => TRUE,
                                'showRemovedLocalizationRecords' => TRUE,
                                'showSynchronizationLink' => TRUE,
@@ -2068,4 +2072,4 @@ tt_content.' . $key . $prefix . ' {
        }
 
 }
        }
 
 }
-?>
\ No newline at end of file
+?>