TYPO3 CMS  TYPO3_7-6
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  */
16 
21 {
27  protected $label = '';
28 
34  protected $type = '';
35 
41  protected $class = '';
42 
48  protected $icon = '';
49 
55  protected $callbackAction = '';
56 
61  public function setClass($class)
62  {
63  $this->class = $class;
64  }
65 
69  public function getClass()
70  {
71  return $this->class;
72  }
73 
78  public function setIcon($icon)
79  {
80  $this->icon = $icon;
81  }
82 
86  public function getIcon()
87  {
88  return $this->icon;
89  }
90 
94  public function setLabel($label)
95  {
96  $this->label = $label;
97  }
98 
102  public function getLabel()
103  {
104  return $this->label;
105  }
106 
111  public function setType($type)
112  {
113  $this->type = $type;
114  }
115 
119  public function getType()
120  {
121  return $this->type;
122  }
123 
131  {
132  $this->callbackAction = $callbackAction;
133  }
134 
140  public function getCallbackAction()
141  {
142  return $this->callbackAction;
143  }
144 
151  public function toArray($addChildNodes = true)
152  {
153  $arrayRepresentation = parent::toArray();
154  $arrayRepresentation = array_merge($arrayRepresentation, [
155  'label' => $this->label,
156  'type' => $this->type,
157  'class' => $this->class,
158  'icon' => $this->icon,
159  'callbackAction' => $this->callbackAction
160  ]);
161  return $arrayRepresentation;
162  }
163 
170  public function dataFromArray($data)
171  {
172  parent::dataFromArray($data);
173  $this->setLabel($data['label']);
174  $this->setType($data['type']);
175  $this->setClass($data['class']);
176  $this->setIcon($data['icon']);
177  $this->setCallbackAction($data['callbackAction']);
178  }
179 }