[TASK] Add possibility to disable DocHeader in ModuleTemplate 65/43865/2
authorOliver Hader <oliver@typo3.org>
Tue, 6 Oct 2015 15:16:44 +0000 (17:16 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 8 Oct 2015 18:19:37 +0000 (20:19 +0200)
Resolves: #70438
Releases: master
Change-Id: Ib7c8191b6ed9fbdf3c8760423ce2fc4fc0c688be
Reviewed-on: http://review.typo3.org/43865
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/backend/Classes/Template/Components/DocHeaderComponent.php
typo3/sysext/backend/Resources/Private/Templates/Module.html

index bf0e5ee..1565b93 100644 (file)
@@ -43,6 +43,11 @@ class DocHeaderComponent {
        protected $buttonBar;
 
        /**
+        * @var bool
+        */
+       protected $enabled = TRUE;
+
+       /**
         * Sets up buttonBar and MenuRegistry
         */
        public function __construct() {
@@ -81,12 +86,36 @@ class DocHeaderComponent {
        }
 
        /**
+        * Determines whether this components is enabled.
+        *
+        * @return bool
+        */
+       public function isEnabled() {
+               return $this->enabled;
+       }
+
+       /**
+        * Sets the enabled property to TRUE.
+        */
+       public function enable() {
+               $this->enabled = TRUE;
+       }
+
+       /**
+        * Sets the enabled property to FALSE (disabled).
+        */
+       public function disable() {
+               $this->enabled = FALSE;
+       }
+
+       /**
         * Returns the abstract content of the docHeader as an array
         *
         * @return array
         */
        public function docHeaderContent() {
                return [
+                       'enabled' => $this->isEnabled(),
                        'buttons' => $this->buttonBar->getButtons(),
                        'menus' => $this->menuRegistry->getMenus(),
                        'metaInformation' => $this->metaInformation
index 256c681..022e6de 100644 (file)
@@ -4,7 +4,9 @@
                        <f:format.raw>{formTag}</f:format.raw>
                </f:then>
        </f:if>
-       <f:render partial="DocHeader" arguments="{docHeader:docHeader}" />
+       <f:if condition="{docHeader.enabled}">
+               <f:render partial="DocHeader" arguments="{docHeader:docHeader}" />
+       </f:if>
        <div class="module-body t3js-module-body">
                <f:format.raw>{content}</f:format.raw>
        </div>