TYPO3 CMS  TYPO3_6-2
BackendLayoutCollection.php
Go to the documentation of this file.
1 <?php
3 
23 
27  protected $identifier;
28 
32  protected $backendLayouts = array();
33 
37  public function __construct($identifier) {
38  $this->setIdentifier($identifier);
39  }
40 
44  public function getIdentifier() {
45  return $this->identifier;
46  }
47 
52  public function setIdentifier($identifier) {
53  if (strpos($identifier, '__') !== FALSE) {
54  throw new \UnexpectedValueException(
55  'Identifier "' . $identifier . '" must not contain "__"',
56  1381597631
57  );
58  }
59 
60  $this->identifier = $identifier;
61  }
62 
69  public function add(BackendLayout $backendLayout) {
70  $identifier = $backendLayout->getIdentifier();
71 
72  if (strpos($identifier, '__') !== FALSE) {
73  throw new \UnexpectedValueException(
74  'BackendLayout Identifier "' . $identifier . '" must not contain "__"',
75  1381597628
76  );
77  }
78 
79  if (isset($this->backendLayouts[$identifier])) {
80  throw new \LogicException(
81  'Backend Layout ' . $identifier . ' is already defined',
82  1381559376
83  );
84  }
85 
86  $this->backendLayouts[$identifier] = $backendLayout;
87  }
88 
95  public function get($identifier) {
96  $backendLayout = NULL;
97 
98  if (isset($this->backendLayouts[$identifier])) {
99  $backendLayout = $this->backendLayouts[$identifier];
100  }
101 
102  return $backendLayout;
103  }
104 
110  public function getAll() {
111  return $this->backendLayouts;
112  }
113 
114 }