public function configure()
    {
        $name = $this->current();
        $config = $this->config;

        $this->loadConfiguration($name, $config);

        /** @var UniformResourceLocator $locator */
        $locator = $this->grav['locator'];

        $registered = stream_get_wrappers();

        $schemes = $config->get("themes.{$name}.streams.schemes", []);
        $schemes += [
            'theme' => [
                'type' => 'ReadOnlyStream',
                'paths' => $locator->findResources("themes://{$name}", false)
            ]
        ];

        foreach ($schemes as $scheme => $config) {
            if (isset($config['paths'])) {
                $locator->addPath($scheme, '', $config['paths']);
            }
            if (isset($config['prefixes'])) {
                foreach ($config['prefixes'] as $prefix => $paths) {
                    $locator->addPath($scheme, $prefix, $paths);
                }
            }

            if (\in_array($scheme, $registered, true)) {
                stream_wrapper_unregister($scheme);
            }
            $type = !empty($config['type']) ? $config['type'] : 'ReadOnlyStream';
            if ($type[0] !== '\\') {
                $type = '\\RocketTheme\\Toolbox\\StreamWrapper\\' . $type;
            }

            if (!stream_wrapper_register($scheme, $type)) {
                throw new \InvalidArgumentException("Stream '{$type}' could not be initialized.");
            }
        }

        // Load languages after streams has been properly initialized
        $this->loadLanguages($this->config);
    }
public function configure()
    {
        $name = $this->current();
        $config = $this->config;

        $this->loadConfiguration($name, $config);

        /** @var UniformResourceLocator $locator */
        $locator = $this->grav['locator'];

        $registered = stream_get_wrappers();

        $schemes = $config->get("themes.{$name}.streams.schemes", []);
        $schemes += [
            'theme' => [
                'type' => 'ReadOnlyStream',
                'paths' => $locator->findResources("themes://{$name}", false)
            ]
        ];

        foreach ($schemes as $scheme => $config) {
            if (isset($config['paths'])) {
                $locator->addPath($scheme, '', $config['paths']);
            }
            if (isset($config['prefixes'])) {
                foreach ($config['prefixes'] as $prefix => $paths) {
                    $locator->addPath($scheme, $prefix, $paths);
                }
            }

            if (\in_array($scheme, $registered, true)) {
                stream_wrapper_unregister($scheme);
            }
            $type = !empty($config['type']) ? $config['type'] : 'ReadOnlyStream';
            if ($type[0] !== '\\') {
                $type = '\\RocketTheme\\Toolbox\\StreamWrapper\\' . $type;
            }

            if (!stream_wrapper_register($scheme, $type)) {
                throw new \InvalidArgumentException("Stream '{$type}' could not be initialized.");
            }
        }

        // Load languages after streams has been properly initialized
        $this->loadLanguages($this->config);
    }
public function configure ( ) { $ name = $ this -> current ( ) ; $ config = $ this -> config ; $ this -> loadConfiguration ( $ name , $ config ) ; /** @var UniformResourceLocator $locator */ $ locator = $ this -> grav [ 'locator' ] ; $ registered = stream_get_wrappers ( ) ; $ schemes = $ config -> get ( "themes.{$name}.streams.schemes" , [ ] ) ; $ schemes += [ 'theme' => [ 'type' => 'ReadOnlyStream' , 'paths' => $ locator -> findResources ( "themes://{$name}" , false ) ] ] ; foreach ( $ schemes as $ scheme => $ config ) { if ( isset ( $ config [ 'paths' ] ) ) { $ locator -> addPath ( $ scheme , '' , $ config [ 'paths' ] ) ; } if ( isset ( $ config [ 'prefixes' ] ) ) { foreach ( $ config [ 'prefixes' ] as $ prefix => $ paths ) { $ locator -> addPath ( $ scheme , $ prefix , $ paths ) ; } } if ( \ in_array ( $ scheme , $ registered , true ) ) { stream_wrapper_unregister ( $ scheme ) ; } $ type = ! empty ( $ config [ 'type' ] ) ? $ config [ 'type' ] : 'ReadOnlyStream' ; if ( $ type [ 0 ] !== '\\' ) { $ type = '\\RocketTheme\\Toolbox\\StreamWrapper\\' . $ type ; } if ( ! stream_wrapper_register ( $ scheme , $ type ) ) { throw new \ InvalidArgumentException ( "Stream '{$type}' could not be initialized." ) ; } } // Load languages after streams has been properly initialized $ this -> loadLanguages ( $ this -> config ) ; }
Configure and prepare streams for current template.

@throws \InvalidArgumentException
Configure and prepare streams for current template .