Skip to content

Adds feature to respect "blindLinkOptions" #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: TYPO3_6-2
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 26 additions & 7 deletions Classes/Browser/ElementBrowserHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ class ElementBrowserHook implements ElementBrowserHookInterface {
*/
protected $tabsConfig;

/**
* Array to store the allowed items temporary
* for use across multiple hook methods which are called by ElementBrowser
*
* @var array
*/
protected $allowedItems = array();

/**
* Initializes global objects
*/
Expand All @@ -89,7 +97,18 @@ public function addAllowedItems($allowedItems) {
$allowedItems[] = $name;
}

return $allowedItems;
// Initializing the action value, possibly removing blinded values again,
// because one of the new allowed items could be in blindLinkOptions array
$blindLinkOptions = isset($this->pObj->thisConfig['blindLinkOptions'])
? GeneralUtility::trimExplode(',', $this->pObj->thisConfig['blindLinkOptions'], TRUE)
: array();
$pBlindLinkOptions = isset($this->pObj->P['params']['blindLinkOptions'])
? GeneralUtility::trimExplode(',', $this->pObj->P['params']['blindLinkOptions'])
: array();

$this->allowedItems = array_diff($allowedItems, $blindLinkOptions, $pBlindLinkOptions);

return $this->allowedItems;
}

/**
Expand Down Expand Up @@ -192,14 +211,14 @@ public function isRTE() {
public function modifyMenuDefinition($menuDef) {

$tabs = $this->configurationManager->getTabsConfiguration();

foreach ($tabs as $key => $tabConfig) {
$menuDef[$key]['isActive'] = $this->pObj->act == $key;
$menuDef[$key]['label'] = $this->languageService->sL($tabConfig['label'], TRUE);
$menuDef[$key]['url'] = '#';
$menuDef[$key]['addParams'] = 'onclick="jumpToUrl(' . GeneralUtility::quoteJSvalue($this->getThisScript() . 'act=' . $key) . ');return false;"';
if (in_array($key, $this->allowedItems)) {
$menuDef[$key]['isActive'] = $this->pObj->act == $key;
$menuDef[$key]['label'] = $this->languageService->sL($tabConfig['label'], TRUE);
$menuDef[$key]['url'] = '#';
$menuDef[$key]['addParams'] = 'onclick="jumpToUrl(' . GeneralUtility::quoteJSvalue($this->getThisScript() . 'act=' . $key) . ');return false;"';
}
}

return $menuDef;
}

Expand Down