TYPO3 CMS  TYPO3_7-6
ContextMenuAction.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 {
27  protected $label = '';
28 
34  protected $id = '';
35 
41  protected $icon = '';
42 
49  protected $class = '';
50 
56  protected $callbackAction = '';
57 
63  protected $type = '';
64 
70  protected $childActions = null;
71 
77  protected $customAttributes = [];
78 
84  public function getLabel()
85  {
86  return $this->label;
87  }
88 
94  public function setLabel($label)
95  {
96  $this->label = $label;
97  }
98 
104  public function getId()
105  {
106  return $this->id;
107  }
108 
114  public function setId($id)
115  {
116  $this->id = $id;
117  }
118 
124  public function getIcon()
125  {
126  return $this->icon;
127  }
128 
135  public function setIcon($icon)
136  {
137  $this->icon = $icon;
138  }
139 
146  public function getClass()
147  {
149  return $this->class;
150  }
151 
158  public function setClass($class)
159  {
161  $this->class = $class;
162  }
163 
169  public function getCallbackAction()
170  {
171  return $this->callbackAction;
172  }
173 
180  {
181  $this->callbackAction = $callbackAction;
182  }
183 
189  public function getType()
190  {
191  return $this->type;
192  }
193 
200  public function setType($type)
201  {
202  $this->type = $type;
203  }
204 
210  public function getChildActions()
211  {
212  return $this->childActions;
213  }
214 
221  public function setChildActions(\TYPO3\CMS\Backend\ContextMenu\ContextMenuActionCollection $actions)
222  {
223  $this->childActions = $actions;
224  }
225 
231  public function hasChildActions()
232  {
233  if ($this->childActions !== null) {
234  return true;
235  }
236  return false;
237  }
238 
245  public function setCustomAttributes(array $customAttributes)
246  {
247  $this->customAttributes = $customAttributes;
248  }
249 
255  public function getCustomAttributes()
256  {
258  }
259 
265  public function toArray()
266  {
267  $arrayRepresentation = [
268  'label' => $this->getLabel(),
269  'id' => $this->getId(),
270  'icon' => $this->getIcon(),
271  'callbackAction' => $this->getCallbackAction(),
272  'type' => $this->getType(),
273  'customAttributes' => $this->getCustomAttributes()
274  ];
275  $arrayRepresentation['childActions'] = '';
276  if ($this->hasChildActions()) {
277  $arrayRepresentation['childActions'] = $this->childActions->toArray();
278  }
279  return $arrayRepresentation;
280  }
281 }
setChildActions(\TYPO3\CMS\Backend\ContextMenu\ContextMenuActionCollection $actions)