[BUGFIX] Do not render shortcut fields for non-shortcut pages 46/41646/3
authorAlexander Stehlik <alexander.stehlik@gmail.com>
Fri, 17 Jul 2015 23:43:31 +0000 (01:43 +0200)
committerAndreas Wolf <andreas.wolf@typo3.org>
Fri, 17 Jul 2015 23:51:19 +0000 (01:51 +0200)
In the info view under "Basic settings" the shortcut and the
shortcut_type fields are only rendered for pages with the
shortcut doktype.

Resolves: #68322
Change-Id: I89ca55ad2b7eb0d46d50c767d6ff98e55c5406bf
Reviewed-on: http://review.typo3.org/41646
Reviewed-by: Andreas Wolf <andreas.wolf@typo3.org>
Tested-by: Andreas Wolf <andreas.wolf@typo3.org>
typo3/sysext/backend/Classes/View/PageLayoutView.php

index 0568e34..0a7cc42 100644 (file)
@@ -1004,6 +1004,12 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
                                        }
                                        $theData[$field] = '<span align="right">' . $row['uid'] . $eI . '</span>';
                                        break;
+                               case 'shortcut':
+                               case 'shortcut_mode':
+                                       if ((int)$row['doktype'] === \TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_SHORTCUT) {
+                                               $theData[$field] = $this->getPagesTableFieldValue($field, $row);
+                                       }
+                                       break;
                                default:
                                        if (substr($field, 0, 6) == 'table_') {
                                                $f2 = substr($field, 6);
@@ -1012,8 +1018,7 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
                                                        $theData[$field] = '&nbsp;&nbsp;' . ($c ? $c : '');
                                                }
                                        } else {
-                                               $theData[$field] = '&nbsp;&nbsp;'
-                                                       . htmlspecialchars(BackendUtility::getProcessedValue('pages', $field, $row[$field]));
+                                               $theData[$field] = $this->getPagesTableFieldValue($field, $row);
                                        }
                        }
                }
@@ -1021,6 +1026,18 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
                return $this->addelement(1, '', $theData);
        }
 
+       /**
+        * Returns the HTML code for rendering a field in the pages table.
+        * The row value is processed to a human readable form and the result is parsed through htmlspecialchars().
+        *
+        * @param string $field The name of the field of which the value should be rendered.
+        * @param array $row The pages table row as an associative array.
+        * @return string The rendered table field value.
+        */
+       protected function getPagesTableFieldValue($field, array $row) {
+               return '&nbsp;&nbsp;' . htmlspecialchars(BackendUtility::getProcessedValue('pages', $field, $row[$field]));
+       }
+
        /**********************************
         *
         * Additional functions; Content Elements