-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
MarkupMenuData.php
40 lines (35 loc) · 1.02 KB
/
MarkupMenuData.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
namespace ProcessWire;
/**
* MarkupMenu menu item data
*
* This is a wrapper class for WireData with some additional features.
*
* @version 0.2.0
* @author Teppo Koivula <[email protected]>
* @license Mozilla Public License v2.0 http://mozilla.org/MPL/2.0/
*/
class MarkupMenuData extends WireData {
/**
* Constructor
*
* @param array $values Stored values
*/
public function __construct(array $values = []) {
if (isset($values['classes']) && is_array($values['classes'])) {
$values['classes'] = implode(' ', $values['classes']);
}
$this->setArray($values);
}
/**
* Retrieve the value for a previously set property
*
* @param string|object $key Name of property you want to retrieve.
* @return mixed|null Returns value of requested property, or null if the property was not found.
* @see WireData::set()
*/
public function get($key) {
if (strpos($key, '.')) return $this->getDot($key);
return parent::get($key); // back to WireData
}
}