public function get($name)
    {
        if (!$name) {
            throw new \RuntimeException('Theme name not provided.');
        }

        $blueprints = new Blueprints('themes://');
        $blueprint = $blueprints->get("{$name}/blueprints");

        // Load default configuration.
        $file = CompiledYamlFile::instance("themes://{$name}/{$name}" . YAML_EXT);

        // ensure this is a valid theme
        if (!$file->exists()) {
            return null;
        }

        // Find thumbnail.
        $thumb = "themes://{$name}/thumbnail.jpg";
        $path = $this->grav['locator']->findResource($thumb, false);

        if ($path) {
            $blueprint->set('thumbnail', $this->grav['base_url'] . '/' . $path);
        }

        $obj = new Data((array)$file->content(), $blueprint);

        // Override with user configuration.
        $obj->merge($this->config->get('themes.' . $name) ?: []);

        // Save configuration always to user/config.
        $file = CompiledYamlFile::instance("config://themes/{$name}" . YAML_EXT);
        $obj->file($file);

        return $obj;
    }
public function get($name)
    {
        if (!$name) {
            throw new \RuntimeException('Theme name not provided.');
        }

        $blueprints = new Blueprints('themes://');
        $blueprint = $blueprints->get("{$name}/blueprints");

        // Load default configuration.
        $file = CompiledYamlFile::instance("themes://{$name}/{$name}" . YAML_EXT);

        // ensure this is a valid theme
        if (!$file->exists()) {
            return null;
        }

        // Find thumbnail.
        $thumb = "themes://{$name}/thumbnail.jpg";
        $path = $this->grav['locator']->findResource($thumb, false);

        if ($path) {
            $blueprint->set('thumbnail', $this->grav['base_url'] . '/' . $path);
        }

        $obj = new Data((array)$file->content(), $blueprint);

        // Override with user configuration.
        $obj->merge($this->config->get('themes.' . $name) ?: []);

        // Save configuration always to user/config.
        $file = CompiledYamlFile::instance("config://themes/{$name}" . YAML_EXT);
        $obj->file($file);

        return $obj;
    }
public function get ( $ name ) { if ( ! $ name ) { throw new \ RuntimeException ( 'Theme name not provided.' ) ; } $ blueprints = new Blueprints ( 'themes://' ) ; $ blueprint = $ blueprints -> get ( "{$name}/blueprints" ) ; // Load default configuration. $ file = CompiledYamlFile :: instance ( "themes://{$name}/{$name}" . YAML_EXT ) ; // ensure this is a valid theme if ( ! $ file -> exists ( ) ) { return null ; } // Find thumbnail. $ thumb = "themes://{$name}/thumbnail.jpg" ; $ path = $ this -> grav [ 'locator' ] -> findResource ( $ thumb , false ) ; if ( $ path ) { $ blueprint -> set ( 'thumbnail' , $ this -> grav [ 'base_url' ] . '/' . $ path ) ; } $ obj = new Data ( ( array ) $ file -> content ( ) , $ blueprint ) ; // Override with user configuration. $ obj -> merge ( $ this -> config -> get ( 'themes.' . $ name ) ? : [ ] ) ; // Save configuration always to user/config. $ file = CompiledYamlFile :: instance ( "config://themes/{$name}" . YAML_EXT ) ; $ obj -> file ( $ file ) ; return $ obj ; }
Get theme configuration or throw exception if it cannot be found.

@param  string $name

@return Data
@throws \RuntimeException
Get theme configuration or throw exception if it cannot be found .