1 | <?php |
||
43 | abstract class Modification extends Component { |
||
44 | |||
45 | private $component = null; |
||
46 | |||
47 | /** |
||
48 | * @param Component $component |
||
49 | * @param \DOMElement $domElement |
||
50 | */ |
||
51 | 2 | public function __construct( Component $component, \DOMElement $domElement = null ) { |
|
52 | |||
53 | 2 | $this->component = $component; |
|
54 | 2 | parent::__construct( $component->getSkinTemplate(), $domElement, $component->getIndent() ); |
|
55 | 2 | } |
|
56 | |||
57 | /** |
||
58 | * This method should apply any modifications to the decorated component |
||
59 | * available from the getComponent() method. |
||
60 | */ |
||
61 | abstract protected function applyModification(); |
||
62 | |||
63 | /** |
||
64 | * @return \DOMElement|null |
||
65 | */ |
||
66 | public function getDomElementOfModification() { |
||
67 | return parent::getDomElement(); |
||
68 | } |
||
69 | |||
70 | /** |
||
71 | * @return \DOMElement |
||
72 | */ |
||
73 | public function getDomElementOfComponent() { |
||
76 | |||
77 | /** |
||
78 | * Sets the class string that should be assigned to the top-level html element of this component |
||
79 | * |
||
80 | * @param string | array | null $classes |
||
81 | * |
||
82 | */ |
||
83 | public function setClasses( $classes ) { |
||
86 | |||
87 | /** |
||
88 | * @return Component |
||
89 | */ |
||
90 | public function getComponent() { |
||
93 | |||
94 | /** |
||
95 | * @param Component $component |
||
96 | * @since 1.1 |
||
97 | */ |
||
98 | 7 | protected function setComponent( Component $component ) { |
|
99 | 7 | $this->component = $component; |
|
100 | 7 | } |
|
101 | |||
102 | /** |
||
103 | * Adds the given class to the class string that should be assigned to the top-level html element of this component |
||
104 | * |
||
105 | * @param string | array | null $classes |
||
106 | * |
||
107 | * @return string | array |
||
108 | */ |
||
109 | public function addClasses( $classes ) { |
||
112 | |||
113 | /** |
||
114 | * @return ChameleonTemplate |
||
115 | */ |
||
116 | public function getSkinTemplate() { |
||
119 | |||
120 | /** |
||
121 | * Returns the current indentation level |
||
122 | * |
||
123 | * @return int |
||
124 | */ |
||
125 | public function getIndent() { |
||
128 | |||
129 | /** |
||
130 | * Returns the class string that should be assigned to the top-level html element of this component |
||
131 | * |
||
132 | * @return string |
||
133 | */ |
||
134 | public function getClassString() { |
||
137 | |||
138 | /** |
||
139 | * Removes the given class from the class string that should be assigned to the top-level html element of this component |
||
140 | * |
||
141 | * @param string | array | null $classes |
||
142 | * |
||
143 | * @return string |
||
144 | */ |
||
145 | public function removeClasses( $classes ) { |
||
148 | |||
149 | /** |
||
150 | * Returns the DOMElement from the description XML file associated with this element. |
||
151 | * |
||
152 | * @return \DOMElement |
||
153 | */ |
||
154 | public function getDomElement() { |
||
157 | |||
158 | /** |
||
159 | * Builds the HTML code for this component |
||
160 | * |
||
161 | * @return String the HTML code |
||
162 | */ |
||
163 | 7 | public function getHtml() { |
|
167 | |||
168 | /** |
||
169 | * @return array the resource loader modules needed by this component |
||
170 | */ |
||
171 | public function getResourceLoaderModules() { |
||
174 | } |
||
175 |