‪TYPO3CMS  10.4
ItemProvider.php
Go to the documentation of this file.
1 <?php
2 
3 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 
21 
26 {
30  protected ‪$itemsConfiguration = [
31  'permissions' => [
32  'type' => 'item',
33  'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_misc.xlf:CM_perms',
34  'iconIdentifier' => 'actions-lock',
35  'callbackAction' => 'openPermissionsModule'
36  ],
37  ];
38 
44  protected function ‪canRender(string $itemName, string $type): bool
45  {
46  if (in_array($itemName, $this->disabledItems, true)) {
47  return false;
48  }
49  return $this->‪canShowPermissionsModule();
50  }
51 
56  public function ‪addItems(array $items): array
57  {
58  $this->‪initDisabledItems();
59  $localItems = $this->‪prepareItems($this->itemsConfiguration);
60  if (isset($items['more']['childItems'])) {
61  $items['more']['childItems'] = $items['more']['childItems'] + $localItems;
62  } else {
63  $items += $localItems;
64  }
65  return $items;
66  }
67 
73  public function ‪getPriority(): int
74  {
75  return 60;
76  }
77 
82  protected function ‪getAdditionalAttributes(string $itemName): array
83  {
84  return ['data-callback-module' => 'TYPO3/CMS/Beuser/ContextMenuActions'];
85  }
86 
92  protected function ‪canShowPermissionsModule(): bool
93  {
94  return $this->‪canBeEdited() && $this->backendUser->check('modules', 'system_BeuserTxPermission');
95  }
96 }
‪TYPO3\CMS\Beuser\ContextMenu\ItemProvider
Definition: ItemProvider.php:26
‪TYPO3\CMS\Backend\ContextMenu\ItemProviders\PageProvider
Definition: PageProvider.php:31
‪TYPO3\CMS\Beuser\ContextMenu
Definition: ItemProvider.php:18
‪TYPO3\CMS\Backend\ContextMenu\ItemProviders\AbstractProvider\prepareItems
‪array prepareItems(array $itemsConfiguration)
Definition: AbstractProvider.php:171
‪TYPO3\CMS\Backend\ContextMenu\ItemProviders\PageProvider\canBeEdited
‪bool canBeEdited()
Definition: PageProvider.php:304
‪TYPO3\CMS\Beuser\ContextMenu\ItemProvider\canShowPermissionsModule
‪bool canShowPermissionsModule()
Definition: ItemProvider.php:91
‪TYPO3\CMS\Beuser\ContextMenu\ItemProvider\getPriority
‪int getPriority()
Definition: ItemProvider.php:72
‪TYPO3\CMS\Beuser\ContextMenu\ItemProvider\canRender
‪bool canRender(string $itemName, string $type)
Definition: ItemProvider.php:43
‪TYPO3\CMS\Beuser\ContextMenu\ItemProvider\getAdditionalAttributes
‪array getAdditionalAttributes(string $itemName)
Definition: ItemProvider.php:81
‪TYPO3\CMS\Beuser\ContextMenu\ItemProvider\addItems
‪array addItems(array $items)
Definition: ItemProvider.php:55
‪TYPO3\CMS\Beuser\ContextMenu\ItemProvider\$itemsConfiguration
‪array $itemsConfiguration
Definition: ItemProvider.php:29
‪TYPO3\CMS\Backend\ContextMenu\ItemProviders\AbstractProvider\initDisabledItems
‪initDisabledItems()
Definition: AbstractProvider.php:142