paths = array(); foreach ($templates as $name => $path) { if (!$path) { $path = $style_root_path . $this->template_root_for_style($name); } $this->paths[] = $path; } $this->main_template_path = $this->paths[0]; } /** * Retrieves the path to the main template passed into set_templates() * * @return string Main template path */ public function get_main_template_path() { return $this->main_template_path; } /** * Converts a style name to relative (to board root or extension) path to * the style's template files. * * @param $style_name string Style name * @return string Path to style template files */ private function template_root_for_style($style_name) { return 'styles/' . $style_name . '/template'; } /** * Retrieve an iterator over all template paths * * @return ArrayIterator An iterator for the array of template paths */ public function getIterator() { return new ArrayIterator($this->paths); } }