‪TYPO3CMS  10.4
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 (strpos(‪$identifier, '__') !== false) {
56  throw new \UnexpectedValueException(
57  'Identifier "' . ‪$identifier . '" must not contain "__"',
58  1381597631
59  );
60  }
61 
62  $this->identifier = ‪$identifier;
63  }
64 
71  public function ‪add(‪BackendLayout $backendLayout)
72  {
73  ‪$identifier = $backendLayout->‪getIdentifier();
74 
75  if (strpos(‪$identifier, '__') !== false) {
76  throw new \UnexpectedValueException(
77  'BackendLayout Identifier "' . ‪$identifier . '" must not contain "__"',
78  1381597628
79  );
80  }
81 
82  if (isset($this->backendLayouts[‪$identifier])) {
83  throw new \LogicException(
84  'Backend Layout ' . ‪$identifier . ' is already defined',
85  1381559376
86  );
87  }
88 
89  $this->backendLayouts[‪$identifier] = $backendLayout;
90  }
91 
98  public function get(‪$identifier)
99  {
100  $backendLayout = null;
101 
102  if (isset($this->backendLayouts[‪$identifier])) {
103  $backendLayout = $this->backendLayouts[‪$identifier];
104  }
105 
106  return $backendLayout;
107  }
108 
114  public function ‪getAll()
115  {
117  }
118 }
‪TYPO3\CMS\Backend\View\BackendLayout\BackendLayoutCollection
Definition: BackendLayoutCollection.php:22
‪TYPO3\CMS\Backend\View\BackendLayout\BackendLayout\getIdentifier
‪string getIdentifier()
Definition: BackendLayout.php:92
‪TYPO3\CMS\Backend\View\BackendLayout\BackendLayoutCollection\getAll
‪array BackendLayout[] getAll()
Definition: BackendLayoutCollection.php:112
‪TYPO3\CMS\Backend\View\BackendLayout\BackendLayoutCollection\add
‪add(BackendLayout $backendLayout)
Definition: BackendLayoutCollection.php:69
‪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:16
‪TYPO3\CMS\Backend\View\BackendLayout\BackendLayout
Definition: BackendLayout.php:25
‪TYPO3\CMS\Backend\View\BackendLayout\BackendLayoutCollection\$identifier
‪string $identifier
Definition: BackendLayoutCollection.php:25