‪TYPO3CMS  9.5
BackendLayoutCollection.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
21 {
25  protected ‪$identifier;
26 
30  protected ‪$backendLayouts = [];
31 
35  public function ‪__construct(‪$identifier)
36  {
38  }
39 
43  public function ‪getIdentifier()
44  {
45  return ‪$this->identifier;
46  }
47 
52  public function ‪setIdentifier(‪$identifier)
53  {
54  if (strpos(‪$identifier, '__') !== false) {
55  throw new \UnexpectedValueException(
56  'Identifier "' . ‪$identifier . '" must not contain "__"',
57  1381597631
58  );
59  }
60 
61  $this->identifier = ‪$identifier;
62  }
63 
70  public function ‪add(‪BackendLayout $backendLayout)
71  {
72  ‪$identifier = $backendLayout->‪getIdentifier();
73 
74  if (strpos(‪$identifier, '__') !== false) {
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:21
‪TYPO3\CMS\Backend\View\BackendLayout\BackendLayout\getIdentifier
‪string getIdentifier()
Definition: BackendLayout.php:77
‪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:33
‪TYPO3\CMS\Backend\View\BackendLayout\BackendLayoutCollection\setIdentifier
‪setIdentifier($identifier)
Definition: BackendLayoutCollection.php:50
‪TYPO3\CMS\Backend\View\BackendLayout\BackendLayoutCollection\getIdentifier
‪string getIdentifier()
Definition: BackendLayoutCollection.php:41
‪TYPO3\CMS\Backend\View\BackendLayout\BackendLayoutCollection\$backendLayouts
‪array BackendLayout[] $backendLayouts
Definition: BackendLayoutCollection.php:28
‪TYPO3\CMS\Backend\View\BackendLayout
Definition: BackendLayout.php:2
‪TYPO3\CMS\Backend\View\BackendLayout\BackendLayout
Definition: BackendLayout.php:21
‪TYPO3\CMS\Backend\View\BackendLayout\BackendLayoutCollection\$identifier
‪string $identifier
Definition: BackendLayoutCollection.php:24