public function testSetTheme()
 {
     $themes = new Themes();
     $theme1 = new Theme('theme1');
     $theme2 = new Theme('theme2');
     $themes->add($theme1);
     $themes->add($theme2);
     $themes->set('theme1');
     $this->assertEquals('theme1', $themes->get());
 }
 /**
  * Add support for vendor named path overrides.
  *
  * @param  string  $name
  * @return string
  */
 protected function findNamedPathView($name)
 {
     list($namespace, $view) = $this->getNamespaceSegments($name);
     $namespaceOverrides = $this->themeEngine->config('namespace-overrides', []);
     if (in_array($namespace, array_keys($namespaceOverrides))) {
         if ($namespaceOverrides[$namespace] === '') {
             $vendorPath = $this->paths[0];
         } else {
             $vendorPath = $this->paths[0] . DIRECTORY_SEPARATOR . $namespaceOverrides[$namespace];
         }
     }
     if (!isset($vendorPath) || !$this->files->isDirectory($vendorPath)) {
         $vendorPath = $this->paths[0] . '/vendor/' . $namespace;
     }
     $hints = $this->hints[$namespace];
     if (!in_array($vendorPath, $hints) && $this->files->isDirectory($vendorPath)) {
         $this->hints[$namespace] = Arr::prepend($hints, $vendorPath);
     }
     return $this->findInPaths($view, $this->hints[$namespace]);
 }
예제 #3
0
 /**
  * URL
  *
  * @return string
  */
 public function url()
 {
     return Themes::url($this->name);
 }