Project

General

Profile

Actions

Feature #76859

closed

Wouldnt it be nice to have onlyLinkOptions in wizard_link

Added by Claus Harup over 7 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Could have
Assignee:
-
Category:
Backend API
Target version:
-
Start date:
2016-06-28
Due date:
% Done:

0%

Estimated time:
PHP Version:
7.0
Tags:
Complexity:
Sprint Focus:

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;
    }

Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Feature #79626: Integrate linkhandler into coreClosed2017-02-04

Actions
Related to TYPO3 Core - Feature #97159: Introduce TCA type "link"ClosedOliver Bartsch2022-03-09

Actions
Actions #1

Updated by Markus Klein over 7 years ago

  • Assignee deleted (Riccardo De Contardi)
  • Target version deleted (next-patchlevel)

Not sure what you mean with

'spec' is not enough to blind

The linkhandler extension may register multiple tabs, each with a dedicated key, eg. tx_news.
You need to blind those keys.

Actions #2

Updated by Claus Harup over 7 years ago

Hi again

"_The linkhandler extension may register multiple tabs, each with a dedicated key, eg. tx_news. You need to blind those keys._"

That is exactly what I meant :-)

Lets us say I have an extension only needed to have the folder tab in the link wizard I would have to blind all linkhandler tabs - the problem is when another extension is loded using another linkhandler tab - I would then have to go back to my original extension and blind those tabs as well :-(

I thought the smart thing here, would be to specify EXACTLY the tabs you need for the link wizard....

Does it give any scence?? :-)

/Claus

Actions #3

Updated by Markus Klein over 7 years ago

  • Target version set to 8 LTS

Yes this makes sense. Can you push a patch including documentation?
Keep in mind though that new features can only go into master and not into released versions.

Actions #4

Updated by Claus Harup over 7 years ago

Hi Markus

I fixed it using the hook:

$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['LinkBrowser']['hooks']['modifyAllowedItems']['handler']
Actions #5

Updated by Riccardo De Contardi almost 7 years ago

  • Target version changed from 8 LTS to 9.0
Actions #6

Updated by Josef Glatz over 6 years ago

Claus, please can you provide a sample of how you using the hook?

Actions #7

Updated by Claus Harup over 6 years ago

class BrowseLinks{

public function modifyAllowedItems($allowedItems, $currentLinkParts){
$P = GeneralUtility::_GET('P');
if(isset($P['params'])){
if(isset($P['params']['onlyLinkOptions'])){
$allowedItems = GeneralUtility::trimExplode(',', $P['params']['onlyLinkOptions'], TRUE);
}
}
return $allowedItems;
}

}

Actions #8

Updated by Susanne Moog about 6 years ago

  • Target version deleted (9.0)
Actions #9

Updated by Benni Mack over 1 year ago

Actions #10

Updated by Benni Mack over 1 year ago

  • Status changed from New to Closed

We've implemented this (finally) in TYPO3 v12.0 with the new option "TCA Type=link". https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/12.0/Feature-97159-NewTCATypeLink.html

Will close the issue now, if you have any further questions, let me know.

Actions

Also available in: Atom PDF