Add option to remove tab menu container's link anchors
authorMatthias Schmidt <gravatronics@live.com>
Sun, 24 Feb 2019 13:41:22 +0000 (14:41 +0100)
committerMatthias Schmidt <gravatronics@live.com>
Sun, 24 Feb 2019 13:41:22 +0000 (14:41 +0100)
See #2509
See #2852

com.woltlab.wcf/templates/__tabMenuFormContainer.tpl
com.woltlab.wcf/templates/__tabTabMenuFormContainer.tpl
wcfsetup/install/files/acp/templates/__tabMenuFormContainer.tpl
wcfsetup/install/files/acp/templates/__tabTabMenuFormContainer.tpl
wcfsetup/install/files/lib/system/form/builder/container/TabMenuFormContainer.class.php

index 8b349ccee5cd9bc9667abc99d7f980d3b1837867..9e45658ac37ee6905fe7323cabd32d4ec3bb8f55 100644 (file)
@@ -8,7 +8,7 @@
                        {foreach from=$container item='child'}
                                {if $child->isAvailable()}
                                        {assign var='__tabMenuFormContainerChildId' value=$child->getPrefixedId()|concat:'Container'}
-                                       <li{if !$child->checkDependencies()} style="display: none;"{/if}><a href="{@$__wcf->getAnchor($__tabMenuFormContainerChildId)}">{@$child->getLabel()}</a></li>
+                                       <li{if !$child->checkDependencies()} style="display: none;"{/if}><a{if $container->usesAnchors()} href="{@$__wcf->getAnchor($__tabMenuFormContainerChildId)}"{/if}>{@$child->getLabel()}</a></li>
                                {/if}
                        {/foreach}
                </ul>
index 2db5b317beb56e8c6b59d932bef94470fa3b6650..86db16771306a27681ba844a429d018d9af19fb8 100644 (file)
@@ -7,7 +7,7 @@
                        {foreach from=$container item='child'}
                                {if $child->isAvailable()}
                                        {assign var='__tabMenuFormContainerChildId' value=$child->getPrefixedId()|concat:'Container'}
-                                       <li{if !$child->checkDependencies()} style="display: none;"{/if}><a href="{@$__wcf->getAnchor($__tabMenuFormContainerChildId)}">{@$child->getLabel()}</a></li>
+                                       <li{if !$child->checkDependencies()} style="display: none;"{/if}><a{if $container->usesAnchors()} href="{@$__wcf->getAnchor($__tabMenuFormContainerChildId)}"{/if}>{@$child->getLabel()}</a></li>
                                {/if}
                        {/foreach}
                </ul>
index 8b349ccee5cd9bc9667abc99d7f980d3b1837867..9e45658ac37ee6905fe7323cabd32d4ec3bb8f55 100644 (file)
@@ -8,7 +8,7 @@
                        {foreach from=$container item='child'}
                                {if $child->isAvailable()}
                                        {assign var='__tabMenuFormContainerChildId' value=$child->getPrefixedId()|concat:'Container'}
-                                       <li{if !$child->checkDependencies()} style="display: none;"{/if}><a href="{@$__wcf->getAnchor($__tabMenuFormContainerChildId)}">{@$child->getLabel()}</a></li>
+                                       <li{if !$child->checkDependencies()} style="display: none;"{/if}><a{if $container->usesAnchors()} href="{@$__wcf->getAnchor($__tabMenuFormContainerChildId)}"{/if}>{@$child->getLabel()}</a></li>
                                {/if}
                        {/foreach}
                </ul>
index 2db5b317beb56e8c6b59d932bef94470fa3b6650..86db16771306a27681ba844a429d018d9af19fb8 100644 (file)
@@ -7,7 +7,7 @@
                        {foreach from=$container item='child'}
                                {if $child->isAvailable()}
                                        {assign var='__tabMenuFormContainerChildId' value=$child->getPrefixedId()|concat:'Container'}
-                                       <li{if !$child->checkDependencies()} style="display: none;"{/if}><a href="{@$__wcf->getAnchor($__tabMenuFormContainerChildId)}">{@$child->getLabel()}</a></li>
+                                       <li{if !$child->checkDependencies()} style="display: none;"{/if}><a{if $container->usesAnchors()} href="{@$__wcf->getAnchor($__tabMenuFormContainerChildId)}"{/if}>{@$child->getLabel()}</a></li>
                                {/if}
                        {/foreach}
                </ul>
index 29d506fbe4d79eb5c8f28670a6c8d546b5a6e578..2bfc906fe350ae3d84fe0a6ba092226578181a4d 100644 (file)
@@ -16,6 +16,12 @@ class TabMenuFormContainer extends FormContainer implements ITabMenuFormContaine
         */
        protected $templateName = '__tabMenuFormContainer';
        
+       /**
+        * is `true` if the links in the tab menu have anchors
+        * @var boolean
+        */
+       protected $useAnchors = true;
+       
        /**
         * @inheritDoc
         */
@@ -23,4 +29,27 @@ class TabMenuFormContainer extends FormContainer implements ITabMenuFormContaine
                $this->addClass('section')
                        ->addClass('tabMenuContainer');
        }
+       
+       /**
+        * Sets if the links in the tab menu have anchors and returns this form container.
+        * 
+        * @param       boolean         $useAnchors
+        * @return      TabMenuFormContainer            this form container
+        */
+       public function useAnchors($useAnchors = true) {
+               $this->useAnchors = $useAnchors;
+               
+               return $this;
+       }
+       
+       /**
+        * Returns `true` if the links in the tab menu have anchors and `false` otherwise.
+        * 
+        * By default, the links in the tab menu have anchors. 
+        * 
+        * @return      boolean
+        */
+       public function usesAnchors() {
+               return $this->useAnchors;
+       }
 }