1 | <?php |
||
13 | class manager |
||
14 | { |
||
15 | /** |
||
16 | * Array that contains all available template location types which are passed |
||
17 | * via the service container |
||
18 | * @var array |
||
19 | */ |
||
20 | protected $template_locations; |
||
21 | |||
22 | /** |
||
23 | * Construct an template locations manager object |
||
24 | * |
||
25 | * @param array $template_locations Template location types passed via the service container |
||
26 | */ |
||
27 | 32 | public function __construct($template_locations) |
|
28 | 1 | { |
|
29 | 32 | $this->register_template_locations($template_locations); |
|
30 | 32 | } |
|
31 | |||
32 | /** |
||
33 | * Get a list of all template location types |
||
34 | * |
||
35 | * Returns an associated array where key is the location id |
||
36 | * and value is array of location name and location description. |
||
37 | * |
||
38 | * @return array Array containing a list of all template locations |
||
39 | */ |
||
40 | 10 | public function get_all_locations() |
|
54 | |||
55 | /** |
||
56 | * Get a list of all template location IDs for display |
||
57 | * |
||
58 | * @return array Array containing a list of all template location IDs |
||
59 | */ |
||
60 | 1 | public function get_all_location_ids() |
|
61 | { |
||
62 | 1 | $template_locations = array(); |
|
63 | |||
64 | 1 | foreach ($this->template_locations as $location_id => $location) |
|
65 | { |
||
66 | 1 | if ($location->will_display()) |
|
67 | 1 | { |
|
68 | 1 | $template_locations[] = $location_id; |
|
69 | 1 | } |
|
70 | 1 | } |
|
71 | |||
72 | 1 | return $template_locations; |
|
73 | } |
||
74 | |||
75 | /** |
||
76 | * Register template locations |
||
77 | * |
||
78 | * @param array $template_locations Template location types passed via the service container |
||
79 | */ |
||
80 | 32 | protected function register_template_locations($template_locations) |
|
90 | } |
||
91 |