igaster\laravelTheme\themeServiceProvider::register PHP Method

register() public method

public register ( )
    public function register()
    {
        /*--------------------------------------------------------------------------
        		| Bind in IOC
        		|--------------------------------------------------------------------------*/
        $this->app->singleton('igaster.themes', function () {
            return new Themes();
        });
        /*--------------------------------------------------------------------------
        		| Is package enabled?
        		|--------------------------------------------------------------------------*/
        if (!Config::get('themes.enabled', true)) {
            return;
        }
        /*--------------------------------------------------------------------------
        		| Extend FileViewFinder
        		|--------------------------------------------------------------------------*/
        $this->app->singleton('view.finder', function ($app) {
            $paths = $app['config']['view.paths'];
            return new \igaster\laravelTheme\themeViewFinder($app['files'], $paths, null, $app['igaster.themes']);
        });
        /*--------------------------------------------------------------------------
        		| Initialize Themes
        		|--------------------------------------------------------------------------*/
        $Themes = $this->app->make('igaster.themes');
        /*--------------------------------------------------------------------------
        		|   Load Themes from theme.php configuration file
        		|--------------------------------------------------------------------------*/
        if (Config::has('themes')) {
            foreach (Config::get('themes.themes') as $themeName => $options) {
                $assetPath = null;
                $viewsPath = null;
                $extends = null;
                if (is_array($options)) {
                    if (array_key_exists('asset-path', $options)) {
                        $assetPath = $options['asset-path'];
                    }
                    if (array_key_exists('views-path', $options)) {
                        $viewsPath = $options['views-path'];
                    }
                    if (array_key_exists('extends', $options)) {
                        $extends = $options['extends'];
                    }
                } else {
                    $themeName = $options;
                }
                $Themes->add(new Theme($themeName, $assetPath, $viewsPath), $extends);
            }
            if (!$Themes->activeTheme) {
                $Themes->set(Config::get('themes.active'));
            }
        }
    }
themeServiceProvider