‪TYPO3CMS  9.5
ItemProvider.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types = 1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
24 {
28  protected ‪$itemsConfiguration = [
29  'permissions' => [
30  'type' => 'item',
31  'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_misc.xlf:CM_perms',
32  'iconIdentifier' => 'actions-lock',
33  'callbackAction' => 'openPermissionsModule'
34  ],
35  ];
36 
42  protected function ‪canRender(string $itemName, string $type): bool
43  {
44  if (in_array($itemName, $this->disabledItems, true)) {
45  return false;
46  }
47  return $this->‪canShowPermissionsModule();
48  }
49 
54  public function ‪addItems(array $items): array
55  {
56  $this->‪initDisabledItems();
57  $localItems = $this->‪prepareItems($this->itemsConfiguration);
58  if (isset($items['more']['childItems'])) {
59  $items['more']['childItems'] = $items['more']['childItems'] + $localItems;
60  } else {
61  $items += $localItems;
62  }
63  return $items;
64  }
65 
71  public function ‪getPriority(): int
72  {
73  return 60;
74  }
75 
80  protected function ‪getAdditionalAttributes(string $itemName): array
81  {
82  return ['data-callback-module' => 'TYPO3/CMS/Beuser/ContextMenuActions'];
83  }
84 
90  protected function ‪canShowPermissionsModule(): bool
91  {
92  return $this->‪canBeEdited() && $this->backendUser->check('modules', 'system_BeuserTxPermission');
93  }
94 }
‪TYPO3\CMS\Beuser\ContextMenu\ItemProvider
Definition: ItemProvider.php:24
‪TYPO3\CMS\Backend\ContextMenu\ItemProviders\PageProvider
Definition: PageProvider.php:27
‪TYPO3\CMS\Beuser\ContextMenu
Definition: ItemProvider.php:3
‪TYPO3\CMS\Backend\ContextMenu\ItemProviders\AbstractProvider\prepareItems
‪array prepareItems(array $itemsConfiguration)
Definition: AbstractProvider.php:165
‪TYPO3\CMS\Backend\ContextMenu\ItemProviders\PageProvider\canBeEdited
‪bool canBeEdited()
Definition: PageProvider.php:278
‪TYPO3\CMS\Beuser\ContextMenu\ItemProvider\canShowPermissionsModule
‪bool canShowPermissionsModule()
Definition: ItemProvider.php:89
‪TYPO3\CMS\Beuser\ContextMenu\ItemProvider\getPriority
‪int getPriority()
Definition: ItemProvider.php:70
‪TYPO3\CMS\Beuser\ContextMenu\ItemProvider\canRender
‪bool canRender(string $itemName, string $type)
Definition: ItemProvider.php:41
‪TYPO3\CMS\Beuser\ContextMenu\ItemProvider\getAdditionalAttributes
‪array getAdditionalAttributes(string $itemName)
Definition: ItemProvider.php:79
‪TYPO3\CMS\Beuser\ContextMenu\ItemProvider\addItems
‪array addItems(array $items)
Definition: ItemProvider.php:53
‪TYPO3\CMS\Beuser\ContextMenu\ItemProvider\$itemsConfiguration
‪array $itemsConfiguration
Definition: ItemProvider.php:27
‪TYPO3\CMS\Backend\ContextMenu\ItemProviders\AbstractProvider\initDisabledItems
‪initDisabledItems()
Definition: AbstractProvider.php:136