[TASK] Unify primary actions in page module 36/40536/3
authorFrank Nägler <typo3@naegler.net>
Mon, 22 Jun 2015 18:41:04 +0000 (20:41 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Tue, 23 Jun 2015 20:38:15 +0000 (22:38 +0200)
Clicks on content elements now open always the edit view.

Resolves: #50992
Releases: master
Change-Id: I899a2076300f12d011c6a797bae04e0b98a5d152
Reviewed-on: http://review.typo3.org/40536
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/backend/Classes/View/PageLayoutView.php
typo3/sysext/css_styled_content/Classes/Hooks/PageLayoutView/ImagePreviewRenderer.php
typo3/sysext/css_styled_content/Classes/Hooks/PageLayoutView/TextpicPreviewRenderer.php
typo3/sysext/felogin/Classes/Hooks/CmsLayout.php

index 5a5705c..38689e6 100644 (file)
@@ -1475,17 +1475,18 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
                                        break;
                                case 'uploads':
                                        if ($row['media']) {
-                                               $out .= $this->thumbCode($row, 'tt_content', 'media') . '<br />';
+                                               $out .= $this->linkEditContent($this->getThumbCodeUnlinked($row, 'tt_content', 'media'), $row) . '<br />';
                                        }
                                        break;
                                case 'menu':
                                        $contentType = $this->CType_labels[$row['CType']];
-                                       $out .= '<strong>' . htmlspecialchars($contentType) . '</strong><br />';
+                                       $out .= $this->linkEditContent('<strong>' . htmlspecialchars($contentType) . '</strong>', $row) . '<br />';
                                        // Add Menu Type
                                        $menuTypeLabel = $this->getLanguageService()->sL(
                                                BackendUtility::getLabelFromItemListMerged($row['pid'], 'tt_content', 'menu_type', $row['menu_type'])
                                        );
-                                       $out .= $menuTypeLabel !== '' ? $menuTypeLabel : 'invalid menu type';
+                                       $menuTypeLabel = $menuTypeLabel ?: 'invalid menu type';
+                                       $out .= $this->linkEditContent($menuTypeLabel, $row);
                                        if ($row['menu_type'] !== '2' && ($row['pages'] || $row['selected_categories'])) {
                                                // Show pages if menu type is not "Sitemap"
                                                $out .= ':' . $this->linkEditContent($this->generateListForCTypeMenu($row), $row) . '<br />';
@@ -1529,7 +1530,7 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
                                        } elseif (!empty($row['list_type'])) {
                                                $label = BackendUtility::getLabelFromItemListMerged($row['pid'], 'tt_content', 'list_type', $row['list_type']);
                                                if (!empty($label)) {
-                                                       $out .=  '<strong>' . $this->getLanguageService()->sL($label, TRUE) . '</strong><br />';
+                                                       $out .=  $this->linkEditContent('<strong>' . $this->getLanguageService()->sL($label, TRUE) . '</strong>', $row) . '<br />';
                                                } else {
                                                        $message = sprintf($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.noMatchingValue'), $row['list_type']);
                                                        $out .= GeneralUtility::makeInstance(
@@ -1554,12 +1555,12 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
                                        $contentType = $this->CType_labels[$row['CType']];
 
                                        if (isset($contentType)) {
-                                               $out .= '<strong>' . htmlspecialchars($contentType) . '</strong><br />';
+                                               $out .= $this->linkEditContent('<strong>' . htmlspecialchars($contentType) . '</strong>', $row) . '<br />';
                                                if ($row['bodytext']) {
                                                        $out .= $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
                                                }
                                                if ($row['image']) {
-                                                       $out .= $this->thumbCode($row, 'tt_content', 'image') . '<br />';
+                                                       $out .= $this->linkEditContent($this->getThumbCodeUnlinked($row, 'tt_content', 'image'), $row) . '<br />';
                                                }
                                        } else {
                                                $message = sprintf(
@@ -2153,6 +2154,18 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
        }
 
        /**
+        * Create thumbnail code for record/field but not linked
+        *
+        * @param mixed[] $row Record array
+        * @param string $table Table (record is from)
+        * @param string $field Field name for which thumbnail are to be rendered.
+        * @return string HTML for thumbnails, if any.
+        */
+       public function getThumbCodeUnlinked($row, $table, $field) {
+               return BackendUtility::thumbCode($row, $table, $field, $this->backPath, '', NULL, 0, '', '', FALSE);
+       }
+
+       /**
         * @return BackendLayoutView
         */
        protected function getBackendLayoutView() {
index 172b645..19f22db 100644 (file)
@@ -38,7 +38,7 @@ class ImagePreviewRenderer implements \TYPO3\CMS\Backend\View\PageLayoutViewDraw
        ) {
                if ($row['CType'] === 'image') {
                        if ($row['image']) {
-                               $itemContent .= $parentObject->thumbCode($row, 'tt_content', 'image');
+                               $itemContent .= $parentObject->linkEditContent($parentObject->getThumbCodeUnlinked($row, 'tt_content', 'image'), $row);
 
                                $fileReferences = \TYPO3\CMS\Backend\Utility\BackendUtility::resolveFileReferences('tt_content', 'image', $row);
 
index 153d32e..60b18d4 100644 (file)
@@ -42,7 +42,7 @@ class TextpicPreviewRenderer implements \TYPO3\CMS\Backend\View\PageLayoutViewDr
                        }
 
                        if ($row['image']) {
-                               $itemContent .= $parentObject->thumbCode($row, 'tt_content', 'image');
+                               $itemContent .= $parentObject->linkEditContent($parentObject->getThumbCodeUnlinked($row, 'tt_content', 'image'), $row);
 
                                $fileReferences = \TYPO3\CMS\Backend\Utility\BackendUtility::resolveFileReferences('tt_content', 'image', $row);
 
index 0961e1d..75c748c 100644 (file)
@@ -33,7 +33,7 @@ class CmsLayout implements \TYPO3\CMS\Backend\View\PageLayoutViewDrawItemHookInt
        public function preProcess(\TYPO3\CMS\Backend\View\PageLayoutView &$parentObject, &$drawItem, &$headerContent, &$itemContent, array &$row) {
                if ($row['CType'] === 'login') {
                        $drawItem = FALSE;
-                       $itemContent .= '<strong>' . $GLOBALS['LANG']->sL('LLL:EXT:cms/layout/locallang_db_new_content_el.xlf:forms_login_title', TRUE) . '</strong>';
+                       $itemContent .= $parentObject->linkEditContent('<strong>' . $GLOBALS['LANG']->sL('LLL:EXT:cms/layout/locallang_db_new_content_el.xlf:forms_login_title', TRUE) . '</strong>', $row);
                }
        }