public function init() { parent::init(); // set the paths as the document root $paths = array(); if (is_array($this->config()->paths)) { foreach ($this->config()->paths as $path) { $paths[] = Director::BaseFolder() . "/" . $path; } } elseif (is_string($this->config()->paths)) { $paths[] = Director::BaseFolder() . "/" . $this->config()->paths; } // set the service $this->setService($this->config()->service, $paths); $this->setRequirements(); // load the fixture file $this->loadFixture(); }
/** * Set the styleguide service on init. * @param String $name The name of the styleguide service. * @param String $paths Project base url. */ public function setService($name, $paths = null) { if (!$paths) { // set the paths as the document root $paths = array(); if (is_array($this->config()->paths)) { foreach ($this->config()->paths as $path) { $paths[] = Director::BaseFolder() . "/" . $path; } } elseif (is_string($this->config()->paths)) { $paths[] = Director::BaseFolder() . "/" . $this->config()->paths; } } $this->styleguide_service = Injector::inst()->create($name); $this->styleguide_service->setURL($paths); }