TYPO3 CMS  TYPO3_8-7
TreeRepresentationNode.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Backend\Tree;
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  */
17 
22 {
28  protected $label = '';
29 
35  protected $type = '';
36 
42  protected $class = '';
43 
49  protected $icon = '';
50 
56  protected $callbackAction = '';
57 
61  public function setClass($class)
62  {
63  $this->class = $class;
64  }
65 
69  public function getClass()
70  {
71  return $this->class;
72  }
73 
77  public function setIcon($icon)
78  {
79  $this->icon = $icon;
80  }
81 
85  public function getIcon()
86  {
87  return $this->icon;
88  }
89 
93  public function setLabel($label)
94  {
95  $this->label = $label;
96  }
97 
101  public function getLabel()
102  {
103  return $this->label;
104  }
105 
109  public function setType($type)
110  {
111  $this->type = $type;
112  }
113 
117  public function getType()
118  {
119  return $this->type;
120  }
121 
128  {
129  $this->callbackAction = $callbackAction;
130  }
131 
137  public function getCallbackAction()
138  {
139  return $this->callbackAction;
140  }
141 
148  public function toArray($addChildNodes = true)
149  {
150  $arrayRepresentation = parent::toArray();
151  $arrayRepresentation = array_merge($arrayRepresentation, [
152  'label' => $this->label,
153  'type' => $this->type,
154  'class' => $this->class,
155  'icon' => $this->icon,
156  'callbackAction' => $this->callbackAction
157  ]);
158  return $arrayRepresentation;
159  }
160 
166  public function dataFromArray($data)
167  {
168  parent::dataFromArray($data);
169  $this->setLabel($data['label']);
170  $this->setType($data['type']);
171  $this->setClass($data['class']);
172  $this->setIcon($data['icon']);
173  $this->setCallbackAction($data['callbackAction']);
174  }
175 }