/** * Add a new theme to the hierarcy. Optionaly define a parent theme. * * @param \igaster\laravelTheme\Theme $theme * @param string $parentName * @return \igaster\laravelTheme\Theme */ public function add(Theme $theme, $parentName = '') { if ($parentName) { $parentTheme = $this->find($parentName); } else { $parentTheme = $this->root; } $theme->addParent($parentTheme); return $theme; }
/** * Add a new theme to the hierarcy. Optionaly define a parent theme. * * @param \igaster\laravelTheme\Theme $theme * @param string $parentName * @return \igaster\laravelTheme\Theme */ public function add(Theme $theme, $parentName = '') { $theme->addParent($parentName ? $this->find($parentName) : $this->root); return $theme; }
public function boot() { /*-------------------------------------------------------------------------- | Pulish configuration file |--------------------------------------------------------------------------*/ $this->publishes([__DIR__ . '/config.php' => config_path('themes.php')]); /*-------------------------------------------------------------------------- | Extend Blade to support Orcherstra\Asset (Asset Managment) | | Syntax: | | @css (filename, alias, depends-on-alias) | @js (filename, alias, depends-on-alias) |--------------------------------------------------------------------------*/ Blade::extend(function ($value) { return preg_replace_callback('/\\@js\\s*\\(\\s*([\\w\\-\\._:\\/]*)\\s*(?:,\\s*([\\w\\-\\._:\\/]*)\\s*,?\\s*(.*))?\\)/', function ($match) { $p1 = \Theme::url($match[1]); $p2 = empty($match[2]) ? $match[1] : $match[2]; $p3 = empty($match[3]) ? '' : $match[3]; if (empty($p2)) { return "<?php Asset::script('{$p2}', '{$p1}');?>"; } elseif (empty($p3)) { return "<?php Asset::script('{$p2}', '{$p1}');?>"; } else { return "<?php Asset::script('{$p2}', '{$p1}', '{$p3}');?>"; } }, $value); }); Blade::extend(function ($value) { return preg_replace_callback('/\\@css\\s*\\(\\s*([\\w\\-\\._:\\/]*)\\s*(?:,\\s*([\\w\\-\\._:\\/]*)\\s*,?\\s*(.*))?\\)/', function ($match) { $p1 = \Theme::url($match[1]); $p2 = empty($match[2]) ? $match[1] : $match[2]; $p3 = empty($match[3]) ? '' : $match[3]; if (empty($p2)) { return "<?php Asset::style('{$p2}', '{$p1}');?>"; } elseif (empty($p3)) { return "<?php Asset::style('{$p2}', '{$p1}');?>"; } else { return "<?php Asset::style('{$p2}', '{$p1}', '{$p3}');?>"; } }, $value); }); }