Issue Feature Closed

#76859Wouldnt it be nice to have onlyLinkOptions in wizard_link

Claus Harup 06/28/16, 23:23 updated 11/10/22, 10:41

Description

Having the following gives us functionality to blind certain link options, but with the new linkhandler configuration ‘spec’ is not enough to blind, hence the config is:

TCEMAIN.linkHandler.extkey.handler = Cobweb\Linkhandler\RecordLinkHandler….

'wizards'  => [
    'link' => [
    'type' => 'popup',
    'title' => 'Folder',
    'icon' => 'actions-open',
    'JSopenParams' => 'height=800,width=800,status=0,menubar=0,scrollbars=1',
    'module' => [
        'name' => 'wizard_link',
        'urlParameters' => ['mode' => 'wizard']
    ],
    'params' => ['blindLinkOptions' => 'page,mail,url,file,spec']
    ]
]

…..so it would be nice to have:

'wizards'  => [
    'link' => [
    'type' => 'popup',
    'title' => 'Folder',
    'icon' => 'actions-open',
    'JSopenParams' => 'height=800,width=800,status=0,menubar=0,scrollbars=1',
    'module' => [
        'name' => 'wizard_link',
        'urlParameters' => ['mode' => 'wizard']
    ],
    'params' => ['onlyLinkOptions' => 'folder']
    ]
]

In BrowseLinksController.php – we could do something like this:

protected function getAllowedItems()
    {
        $allowedItems = parent::getAllowedItems();

        $blindLinkOptions = isset($this->thisConfig['blindLinkOptions'])
            ? GeneralUtility::trimExplode(',', $this->thisConfig['blindLinkOptions'], true)
            : [];
        $allowedItems = array_diff($allowedItems, $blindLinkOptions);

        if (is_array($this->buttonConfig['options.']) && $this->buttonConfig['options.']['removeItems']) {
            $allowedItems = array_diff($allowedItems, GeneralUtility::trimExplode(',', $this->buttonConfig['options.']['removeItems'], true));
        }

        if(isset($this->thisConfig['onlyLinkOptions'])){
            $onlyLinkOptions = GeneralUtility::trimExplode(',', $this->thisConfig['onlyLinkOptions'], true);

            $allowedItems = array_diff($allowedItems, $onlyLinkOptions);
        }

        return $allowedItems;
    }

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.