• REGISTRATION REQUIREMENTS:

    Your username here MUST MATCH your XenForo username (connected to your XF license).

    Once you have registered here, then you need to start a conversation at xenforo.com w/Bob and provide the following:
    1. Your XenForo License Validation Token
    2. The Domain Name associated with the License
    NOTE: Your account will be validated once ALL requirements are verified/met. Thank you for your patience.

Resolved Get rid of search menu

Robert9

Member
AMS
Showcase
Sportsbook
You may have a hint how i can get rid of some of the tabs at the search page, please?
 
Last edited by a moderator:
You may have a hint how i can get rid of some of the tabs at the search page, please?
Yes, 'getSearchFormTab()' is a core function in the src/XF/Search/Data/AbstractData.php that when implementing a search handler in an addon, its used to add a TAB to the search. If an addon does not implement a 'getSearchFormTab()' function in the handler, then the abstract returns false.

PHP:
    public function getSearchFormTab()
    {
        return null;
    }


AMS implements a search handler and adds a tab (just like XFRM and XFMG do).

src/Addons/XenAddons/AMS/Search/Data/ArticleItem.php 'getSearchFormTab()' (line

PHP:
    public function getSearchFormTab()
    {
        /** @var \XenAddons\AMS\XF\Entity\User $visitor */
        $visitor = \XF::visitor();
        if (!method_exists($visitor, 'canViewAmsArticles') || !$visitor->canViewAmsArticles())
        {
            return null;
        }

        return [
            'title' => \XF::phrase('xa_ams_search_articles'),
            'order' => 131 
        ];
    }

You'd have to modify the file by either removing the method or just returning false. You'd need to do this for ANY addon (to include XFRM and XFMG) to remove tabs from search.
 
I can return null in getSearchFormTab;
means i should add an addon with all classes to extend what i dont like, ok.

So we both found it. :)
Thank you.
 
Last edited by a moderator:
Back
Top