1: <?php
2:
3: namespace ModHelper;
4:
5: 6: 7: 8:
9: class Linktree
10: {
11: protected $collection = array();
12:
13: public function execute()
14: {
15: global $context;
16:
17: foreach ($this->collection as $item) {
18: $context['linktree'][] = $item;
19: }
20: }
21:
22: public function add($name, $url = null, $before = null, $after = null, $first = false)
23: {
24: $item = array(
25: 'name' => $name,
26: );
27: if ($url !== null)
28: $item['url'] = $url;
29: if ($before !== null)
30: $item['extra_before'] = $before;
31: if ($after !== null)
32: $item['extra_after'] = $after
33:
34: $this->collection->addValue($item);
35:
36: return $this;
37: }
38:
39: public function __construct()
40: {
41: $this->collection = new Collection();
42:
43: return $this;
44: }
45:
46: }
47: