From: Matthias Schmidt Date: Sun, 24 Feb 2019 13:41:22 +0000 (+0100) Subject: Add option to remove tab menu container's link anchors X-Git-Tag: 5.2.0_Alpha_1~269 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d6ea6768c2a61002dd7c263811fce2ea59eec775;p=GitHub%2FWoltLab%2FWCF.git Add option to remove tab menu container's link anchors See #2509 See #2852 --- diff --git a/com.woltlab.wcf/templates/__tabMenuFormContainer.tpl b/com.woltlab.wcf/templates/__tabMenuFormContainer.tpl index 8b349ccee5..9e45658ac3 100644 --- a/com.woltlab.wcf/templates/__tabMenuFormContainer.tpl +++ b/com.woltlab.wcf/templates/__tabMenuFormContainer.tpl @@ -8,7 +8,7 @@ {foreach from=$container item='child'} {if $child->isAvailable()} {assign var='__tabMenuFormContainerChildId' value=$child->getPrefixedId()|concat:'Container'} - checkDependencies()} style="display: none;"{/if}>{@$child->getLabel()} + checkDependencies()} style="display: none;"{/if}>usesAnchors()} href="{@$__wcf->getAnchor($__tabMenuFormContainerChildId)}"{/if}>{@$child->getLabel()} {/if} {/foreach} diff --git a/com.woltlab.wcf/templates/__tabTabMenuFormContainer.tpl b/com.woltlab.wcf/templates/__tabTabMenuFormContainer.tpl index 2db5b317be..86db167713 100644 --- a/com.woltlab.wcf/templates/__tabTabMenuFormContainer.tpl +++ b/com.woltlab.wcf/templates/__tabTabMenuFormContainer.tpl @@ -7,7 +7,7 @@ {foreach from=$container item='child'} {if $child->isAvailable()} {assign var='__tabMenuFormContainerChildId' value=$child->getPrefixedId()|concat:'Container'} - checkDependencies()} style="display: none;"{/if}>{@$child->getLabel()} + checkDependencies()} style="display: none;"{/if}>usesAnchors()} href="{@$__wcf->getAnchor($__tabMenuFormContainerChildId)}"{/if}>{@$child->getLabel()} {/if} {/foreach} diff --git a/wcfsetup/install/files/acp/templates/__tabMenuFormContainer.tpl b/wcfsetup/install/files/acp/templates/__tabMenuFormContainer.tpl index 8b349ccee5..9e45658ac3 100644 --- a/wcfsetup/install/files/acp/templates/__tabMenuFormContainer.tpl +++ b/wcfsetup/install/files/acp/templates/__tabMenuFormContainer.tpl @@ -8,7 +8,7 @@ {foreach from=$container item='child'} {if $child->isAvailable()} {assign var='__tabMenuFormContainerChildId' value=$child->getPrefixedId()|concat:'Container'} - checkDependencies()} style="display: none;"{/if}>{@$child->getLabel()} + checkDependencies()} style="display: none;"{/if}>usesAnchors()} href="{@$__wcf->getAnchor($__tabMenuFormContainerChildId)}"{/if}>{@$child->getLabel()} {/if} {/foreach} diff --git a/wcfsetup/install/files/acp/templates/__tabTabMenuFormContainer.tpl b/wcfsetup/install/files/acp/templates/__tabTabMenuFormContainer.tpl index 2db5b317be..86db167713 100644 --- a/wcfsetup/install/files/acp/templates/__tabTabMenuFormContainer.tpl +++ b/wcfsetup/install/files/acp/templates/__tabTabMenuFormContainer.tpl @@ -7,7 +7,7 @@ {foreach from=$container item='child'} {if $child->isAvailable()} {assign var='__tabMenuFormContainerChildId' value=$child->getPrefixedId()|concat:'Container'} - checkDependencies()} style="display: none;"{/if}>{@$child->getLabel()} + checkDependencies()} style="display: none;"{/if}>usesAnchors()} href="{@$__wcf->getAnchor($__tabMenuFormContainerChildId)}"{/if}>{@$child->getLabel()} {/if} {/foreach} diff --git a/wcfsetup/install/files/lib/system/form/builder/container/TabMenuFormContainer.class.php b/wcfsetup/install/files/lib/system/form/builder/container/TabMenuFormContainer.class.php index 29d506fbe4..2bfc906fe3 100644 --- a/wcfsetup/install/files/lib/system/form/builder/container/TabMenuFormContainer.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/container/TabMenuFormContainer.class.php @@ -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; + } }