Esempio n. 1
0
 /**
  * Register composer event to a view
  * 
  * for registering a composer to a theme partial
  *
  *  <code>
  *
  *      $theme->composer('menu', function($view){
  *          
  *          $view->with('theme_menu', "This is loaded from composer of the theme.");  
  *      });
  *      
  *  </code>
  *
  * @param  string|array  $view
  * @param  Closure       $composer
  * @return void
  */
 public function composer($views, $composer)
 {
     $views = (array) $views;
     $theme_name = $this->_theme_name;
     $theme_path_relative = $this->_theme_path . DS . $theme_name;
     $theme_path_absolute = $this->_theme_base_path . $theme_path_relative;
     $theme_partials_path_absolute = $theme_path_absolute . DS . 'partials';
     foreach ($views as $view) {
         if (file_exists($tpath = $theme_partials_path_absolute . DS . $view . EXT)) {
             $view = "path: " . $tpath;
             //View::make("path: " . $tpath);
         } elseif (file_exists($tpath = $theme_partials_path_absolute . DS . $view . BLADE_EXT)) {
             $view = "path: " . $tpath;
             //View::make("path: " . $tpath);
         }
         View::composer($view, $composer);
     }
     return $this;
 }