Exemple #1
0
 /**
  * Find the view file.
  *
  * @param    string      $view
  * @param    string|null $module
  * @return    string
  */
 protected function find($view, $module = null)
 {
     if (!is_null($module)) {
         $path = "Modules/{$module}/Views/{$view}";
     } else {
         $path = "Views/{$view}";
     }
     // Make the path absolute and adjust the directory separator.
     $path = str_replace('/', DS, APPDIR . $path);
     //
     $filePath = $this->finder->find($path);
     if (!is_null($filePath)) {
         return $filePath;
     }
     throw new \InvalidArgumentException("Unable to load the view '" . $view . "' on domain '" . ($module ?: 'App') . "'.", 1);
 }
 /**
  * Find the View file.
  *
  * @param    string     $view
  * @param    string     $template
  * @return    string
  */
 protected function find($view, $template = null)
 {
     // Calculate the current Template name.
     $template = $template ?: Config::get('app.template');
     // Calculate the search path.
     $path = sprintf('Templates/%s/%s', $template, $view);
     // Make the path absolute and adjust the directory separator.
     $path = str_replace('/', DS, APPDIR . $path);
     // Find the View file depending on the Language direction.
     $language = $this->getLanguage();
     if ($language->direction() == 'rtl') {
         // Search for the View file used on the RTL languages.
         $filePath = $this->finder->find($path . '-rtl');
     } else {
         $filePath = null;
     }
     if (is_null($filePath)) {
         $filePath = $this->finder->find($path);
     }
     if (!is_null($filePath)) {
         return $filePath;
     }
     throw new \InvalidArgumentException("Unable to load the view '" . $view . "' on template '" . $template . "'.", 1);
 }