TYPO3 CMS  TYPO3_8-7
FormFileProvider.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types = 1);
3 namespace TYPO3\CMS\Form\Hooks;
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 
26 {
30  protected $itemsConfiguration = [];
31 
37  public function getPriority(): int
38  {
39  return 0;
40  }
41 
45  public function canHandle(): bool
46  {
47  return parent::canHandle()
49  }
50 
55  public function addItems(array $items): array
56  {
57  parent::initialize();
58  return $this->purgeItems($items);
59  }
60 
73  protected function purgeItems(array $items): array
74  {
75  foreach ($items as $name => $item) {
76  $type = $item['type'];
77 
78  if ($type === 'submenu' && !empty($item['childItems'])) {
79  $item['childItems'] = $this->purgeItems($item['childItems']);
80  } elseif (!parent::canRender($name, $type)) {
81  unset($items[$name]);
82  }
83  }
84 
85  return $items;
86  }
87 
91  protected function canBeEdited(): bool
92  {
93  return false;
94  }
95 
99  protected function canBeRenamed(): bool
100  {
101  return false;
102  }
103 }
static endsWith($haystack, $needle)