‪TYPO3CMS  ‪main
BackendLayoutCollection.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
22 {
26  protected ‪$identifier;
27 
31  protected ‪$backendLayouts = [];
32 
36  public function ‪__construct(‪$identifier)
37  {
39  }
40 
44  public function ‪getIdentifier()
45  {
46  return ‪$this->identifier;
47  }
48 
53  public function ‪setIdentifier(‪$identifier)
54  {
55  if (str_contains(‪$identifier, '__')) {
56  throw new \UnexpectedValueException(
57  'Identifier "' . ‪$identifier . '" must not contain "__"',
58  1381597631
59  );
60  }
61 
62  $this->identifier = ‪$identifier;
63  }
64 
70  public function ‪add(‪BackendLayout $backendLayout)
71  {
72  ‪$identifier = $backendLayout->‪getIdentifier();
73 
74  if (str_contains(‪$identifier, '__')) {
75  throw new \UnexpectedValueException(
76  'BackendLayout Identifier "' . ‪$identifier . '" must not contain "__"',
77  1381597628
78  );
79  }
80 
81  if (isset($this->backendLayouts[‪$identifier])) {
82  throw new \LogicException(
83  'Backend Layout ' . ‪$identifier . ' is already defined',
84  1381559376
85  );
86  }
87 
88  $this->backendLayouts[‪$identifier] = $backendLayout;
89  }
90 
97  public function get(‪$identifier)
98  {
99  $backendLayout = null;
100 
101  if (isset($this->backendLayouts[‪$identifier])) {
102  $backendLayout = $this->backendLayouts[‪$identifier];
103  }
104 
105  return $backendLayout;
106  }
107 
113  public function ‪getAll()
114  {
116  }
117 }
‪TYPO3\CMS\Backend\View\BackendLayout\BackendLayoutCollection
Definition: BackendLayoutCollection.php:22
‪TYPO3\CMS\Backend\View\BackendLayout\BackendLayoutCollection\getAll
‪array BackendLayout[] getAll()
Definition: BackendLayoutCollection.php:111
‪TYPO3\CMS\Backend\View\BackendLayout\BackendLayoutCollection\add
‪add(BackendLayout $backendLayout)
Definition: BackendLayoutCollection.php:68
‪TYPO3\CMS\Backend\View\BackendLayout\BackendLayoutCollection\__construct
‪__construct($identifier)
Definition: BackendLayoutCollection.php:34
‪TYPO3\CMS\Backend\View\BackendLayout\BackendLayoutCollection\setIdentifier
‪setIdentifier($identifier)
Definition: BackendLayoutCollection.php:51
‪TYPO3\CMS\Backend\View\BackendLayout\BackendLayoutCollection\getIdentifier
‪string getIdentifier()
Definition: BackendLayoutCollection.php:42
‪TYPO3\CMS\Backend\View\BackendLayout\BackendLayoutCollection\$backendLayouts
‪array BackendLayout[] $backendLayouts
Definition: BackendLayoutCollection.php:29
‪TYPO3\CMS\Backend\View\BackendLayout
Definition: BackendLayout.php:18
‪TYPO3\CMS\Backend\View\BackendLayout\BackendLayout\getIdentifier
‪getIdentifier()
Definition: BackendLayout.php:62
‪TYPO3\CMS\Backend\View\BackendLayout\BackendLayout
Definition: BackendLayout.php:27
‪TYPO3\CMS\Backend\View\BackendLayout\BackendLayoutCollection\$identifier
‪string $identifier
Definition: BackendLayoutCollection.php:25