[TASK] EXT:viewpage: Added page title as headline 45/51045/3
authorMichael Oehlhof <typo3@oehlhof.de>
Mon, 26 Dec 2016 00:45:06 +0000 (01:45 +0100)
committerMorton Jonuschat <m.jonuschat@mojocode.de>
Sat, 31 Dec 2016 16:44:19 +0000 (17:44 +0100)
Resolves: #77573
Releases: master
Change-Id: If4aaa1f4f9f49e39ecdaee12fc8568ed3839a0ea
Reviewed-on: https://review.typo3.org/51045
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Gianluigi Martino <gmartino27@gmail.com>
Tested-by: Gianluigi Martino <gmartino27@gmail.com>
Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: Morton Jonuschat <m.jonuschat@mojocode.de>
typo3/sysext/viewpage/Classes/Controller/ViewModuleController.php
typo3/sysext/viewpage/Resources/Private/Layouts/DocHeader.html

index 90abb70..2169858 100644 (file)
@@ -108,6 +108,7 @@ class ViewModuleController extends ActionController
         $this->view->assign('widths', $this->getPreviewFrameWidths());
         $this->view->assign('url', $this->getTargetUrl());
         $this->view->assign('languages', $this->getPreviewLanguages());
+        $this->view->assign('pageTitle', $this->getPageTitle());
     }
 
     /**
@@ -304,6 +305,22 @@ class ViewModuleController extends ActionController
     }
 
     /**
+     * Returns the page title
+     *
+     * @return string
+     */
+    protected function getPageTitle()
+    {
+        $pageIdToShow = (int)GeneralUtility::_GP('id');
+        $pageRecord = BackendUtility::getRecord('pages', $pageIdToShow);
+        $pageRecordTitle = is_array($pageRecord)
+            ? BackendUtility::getRecordTitle('pages', $pageRecord)
+            : '';
+
+        return $pageRecordTitle;
+    }
+
+    /**
      * Gets the L parameter from the user session
      *
      * @return string
index b6b0c5f..92ef2da 100644 (file)
@@ -7,6 +7,9 @@
                0:'TYPO3/CMS/Viewpage/Main'
        }" />
 <div class="tx_viewpage">
+       <f:if condition="{pageTitle}">
+               <h1>{pageTitle}</h1>
+       </f:if>
        <div class="panel panel-default">
                <div class="panel-body">
                        <form class="form-inline">