‪TYPO3CMS  10.4
FormFileProvider.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 
18 namespace ‪TYPO3\CMS\Form\Hooks;
19 
23 
29 {
33  protected ‪$itemsConfiguration = [];
34 
40  public function ‪getPriority(): int
41  {
42  return 0;
43  }
44 
48  public function ‪canHandle(): bool
49  {
50  return parent::canHandle()
52  }
53 
58  public function ‪addItems(array $items): array
59  {
60  parent::initialize();
61  return $this->‪purgeItems($items);
62  }
63 
76  protected function ‪purgeItems(array $items): array
77  {
78  foreach ($items as $name => $item) {
79  $type = $item['type'];
80 
81  if ($type === 'submenu' && !empty($item['childItems'])) {
82  $item['childItems'] = $this->‪purgeItems($item['childItems']);
83  } elseif (!parent::canRender($name, $type)) {
84  unset($items[$name]);
85  }
86  }
87 
88  return $items;
89  }
90 
94  protected function ‪canBeEdited(): bool
95  {
96  return false;
97  }
98 
102  protected function ‪canBeRenamed(): bool
103  {
104  return false;
105  }
106 }
‪TYPO3\CMS\Core\Utility\StringUtility\endsWith
‪static bool endsWith($haystack, $needle)
Definition: StringUtility.php:61
‪TYPO3\CMS\Form\Hooks\FormFileProvider\getPriority
‪int getPriority()
Definition: FormFileProvider.php:39
‪TYPO3\CMS\Form\Hooks\FormFileProvider\canBeRenamed
‪bool canBeRenamed()
Definition: FormFileProvider.php:101
‪TYPO3\CMS\Form\Hooks\FormFileProvider\canBeEdited
‪bool canBeEdited()
Definition: FormFileProvider.php:93
‪TYPO3\CMS\Form\Hooks
Definition: DataStructureIdentifierHook.php:18
‪TYPO3\CMS\Form\Hooks\FormFileProvider\addItems
‪array addItems(array $items)
Definition: FormFileProvider.php:57
‪TYPO3\CMS\Form\Mvc\Persistence\FormPersistenceManager
Definition: FormPersistenceManager.php:54
‪TYPO3\CMS\Filelist\ContextMenu\ItemProviders\FileProvider
Definition: FileProvider.php:33
‪TYPO3\CMS\Form\Hooks\FormFileProvider\canHandle
‪bool canHandle()
Definition: FormFileProvider.php:47
‪TYPO3\CMS\Form\Hooks\FormFileProvider
Definition: FormFileProvider.php:29
‪TYPO3\CMS\Core\Utility\StringUtility
Definition: StringUtility.php:22
‪TYPO3\CMS\Form\Hooks\FormFileProvider\purgeItems
‪array purgeItems(array $items)
Definition: FormFileProvider.php:75
‪TYPO3\CMS\Form\Hooks\FormFileProvider\$itemsConfiguration
‪array $itemsConfiguration
Definition: FormFileProvider.php:32
‪TYPO3\CMS\Form\Mvc\Persistence\FormPersistenceManager\FORM_DEFINITION_FILE_EXTENSION
‪const FORM_DEFINITION_FILE_EXTENSION
Definition: FormPersistenceManager.php:55