‪TYPO3CMS  9.5
FormFileProvider.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 
21 
27 {
31  protected ‪$itemsConfiguration = [];
32 
38  public function ‪getPriority(): int
39  {
40  return 0;
41  }
42 
46  public function ‪canHandle(): bool
47  {
48  return parent::canHandle()
50  }
51 
56  public function ‪addItems(array $items): array
57  {
58  parent::initialize();
59  return $this->‪purgeItems($items);
60  }
61 
74  protected function ‪purgeItems(array $items): array
75  {
76  foreach ($items as $name => $item) {
77  $type = $item['type'];
78 
79  if ($type === 'submenu' && !empty($item['childItems'])) {
80  $item['childItems'] = $this->‪purgeItems($item['childItems']);
81  } elseif (!parent::canRender($name, $type)) {
82  unset($items[$name]);
83  }
84  }
85 
86  return $items;
87  }
88 
92  protected function ‪canBeEdited(): bool
93  {
94  return false;
95  }
96 
100  protected function ‪canBeRenamed(): bool
101  {
102  return false;
103  }
104 }
‪TYPO3\CMS\Core\Utility\StringUtility\endsWith
‪static bool endsWith($haystack, $needle)
Definition: StringUtility.php:60
‪TYPO3\CMS\Form\Hooks\FormFileProvider\getPriority
‪int getPriority()
Definition: FormFileProvider.php:37
‪TYPO3\CMS\Form\Hooks\FormFileProvider\canBeRenamed
‪bool canBeRenamed()
Definition: FormFileProvider.php:99
‪TYPO3\CMS\Form\Hooks\FormFileProvider\canBeEdited
‪bool canBeEdited()
Definition: FormFileProvider.php:91
‪TYPO3\CMS\Form\Hooks
Definition: DataStructureIdentifierHook.php:3
‪TYPO3\CMS\Form\Hooks\FormFileProvider\addItems
‪array addItems(array $items)
Definition: FormFileProvider.php:55
‪TYPO3\CMS\Form\Mvc\Persistence\FormPersistenceManager
Definition: FormPersistenceManager.php:48
‪TYPO3\CMS\Filelist\ContextMenu\ItemProviders\FileProvider
Definition: FileProvider.php:29
‪TYPO3\CMS\Form\Hooks\FormFileProvider\canHandle
‪bool canHandle()
Definition: FormFileProvider.php:45
‪TYPO3\CMS\Form\Hooks\FormFileProvider
Definition: FormFileProvider.php:27
‪TYPO3\CMS\Core\Utility\StringUtility
Definition: StringUtility.php:21
‪TYPO3\CMS\Form\Hooks\FormFileProvider\purgeItems
‪array purgeItems(array $items)
Definition: FormFileProvider.php:73
‪TYPO3\CMS\Form\Hooks\FormFileProvider\$itemsConfiguration
‪array $itemsConfiguration
Definition: FormFileProvider.php:30
‪TYPO3\CMS\Form\Mvc\Persistence\FormPersistenceManager\FORM_DEFINITION_FILE_EXTENSION
‪const FORM_DEFINITION_FILE_EXTENSION
Definition: FormPersistenceManager.php:49