Esempio n. 1
0
 /**
  * Load Gantry framework before dispatching to the component.
  */
 private function onAfterRouteSite()
 {
     $template = $this->app->getTemplate(true);
     if (!file_exists(JPATH_THEMES . "/{$template->template}/gantry/theme.yaml")) {
         return;
     }
     $path = JPATH_THEMES . "/{$template->template}/includes/gantry.php";
     if (is_file($path)) {
         // Manually setup Gantry 5 Framework from the template.
         include $path;
         return;
     }
     // Setup Gantry 5 Framework or throw exception.
     Gantry5\Loader::setup();
     // Get Gantry instance.
     $gantry = Gantry\Framework\Gantry::instance();
     // Initialize the template.
     $gantry['theme.path'] = JPATH_THEMES . "/{$template->template}";
     $gantry['theme.name'] = $template->template;
     $themePath = $gantry['theme.path'] . '/includes/theme.php';
     include_once $themePath;
     /** @var \Gantry\Framework\Configurations $configurations */
     $configurations = $gantry['configurations'];
     /** @var Gantry\Framework\Theme $theme */
     $theme = $gantry['theme'];
     $theme->setLayout($configurations->current());
 }
 /**
  * @param array $data
  * @return Renderer
  */
 public function createView(array $data = array())
 {
     $renderer = new Renderer($data);
     $name = $this->getName();
     // Add the default view path
     $renderer->addIncludePath(COMPONENT_ROOT . '/src/views/' . $this->getName());
     $template = $this->app->getTemplate();
     $option = $this->input->get('option');
     // Prepend the template path
     $renderer->addIncludePath(JPATH_ROOT . '/templates/' . $template . '/html/' . $option . '/' . $this->getName(), true);
     return $renderer;
 }
Esempio n. 3
0
 /**
  * Load Gantry framework before dispatching to the component.
  */
 private function onAfterRouteSite()
 {
     $template = $this->app->getTemplate(true);
     if (!file_exists(JPATH_THEMES . "/{$template->template}/gantry/theme.yaml")) {
         return;
     }
     $gantryPath = JPATH_THEMES . "/{$template->template}/includes/gantry.php";
     if (is_file($gantryPath)) {
         // Manually setup Gantry 5 Framework from the template.
         include_once $gantryPath;
     } else {
         // Setup Gantry 5 Framework or throw exception.
         Gantry5\Loader::setup();
         // Get Gantry instance.
         $gantry = Gantry\Framework\Gantry::instance();
         // Initialize the template.
         $gantry['theme.path'] = JPATH_THEMES . "/{$template->template}";
         $gantry['theme.name'] = $template->template;
         $themePath = $gantry['theme.path'] . '/includes/theme.php';
         include_once $themePath;
     }
     /** @var Gantry\Framework\Theme $theme */
     $theme = $gantry['theme'];
     /** @var \Gantry\Framework\Outlines $configurations */
     $configurations = $gantry['configurations'];
     $theme->setLayout($configurations->current());
     if (!$this->params->get('production', 0) || $this->params->get('asset_timestamps', 1)) {
         $age = (int) ($this->params->get('asset_timestamps_period', 7) * 86400);
         Gantry\Framework\Document::$timestamp_age = $age > 0 ? $age : PHP_INT_MAX;
     } else {
         Gantry\Framework\Document::$timestamp_age = 0;
     }
 }
Esempio n. 4
0
 /**
  * Checks : J template html override css file then fabrik list tmpl template css file. Including them if found
  *
  * @since 3.0 loads lists's css files
  *
  * @return  void
  */
 public function getListCss()
 {
     $tmpl = $this->getTmpl();
     $jTmplFolder = FabrikWorker::j3() ? 'tmpl' : 'tmpl25';
     // Check for a form template file (code moved from view)
     if ($tmpl != '') {
         $qs = '?c=' . $this->getRenderContext();
         // $$$rob need & for pdf output which is parsed through xml parser otherwise fails
         $qs .= '&buttoncount=' . $this->rowActionCount;
         // $$$ hugh - adding format, so custom CSS can do things like adding overrides for PDF
         $qs .= '&format=' . $this->app->input->get('format', 'html');
         $overRide = 'templates/' . $this->app->getTemplate() . '/html/com_fabrik/list/' . $tmpl . '/template_css.php' . $qs;
         if (!FabrikHelperHTML::stylesheetFromPath($overRide)) {
             FabrikHelperHTML::stylesheetFromPath('components/com_fabrik/views/list/' . $jTmplFolder . '/' . $tmpl . '/template_css.php' . $qs);
         }
         /* $$$ hugh - as per Skype conversation with Rob, decided to re-instate the custom.css convention.  So I'm adding two files:
          * custom.css - for backward compatibility with existing 2.x custom.css
          * custom_css.php - what we'll recommend people use for custom css moving forward.
          */
         if (!FabrikHelperHTML::stylesheetFromPath('templates/' . $this->app->getTemplate() . '/html/com_fabrik/list/' . $tmpl . '/custom.css' . $qs)) {
             FabrikHelperHTML::stylesheetFromPath('components/com_fabrik/views/list/' . $jTmplFolder . '/' . $tmpl . '/custom.css');
         }
         if (!FabrikHelperHTML::stylesheetFromPath('templates/' . $this->app->getTemplate() . '/html/com_fabrik/list/' . $tmpl . '/custom_css.php' . $qs)) {
             $displayData = new stdClass();
             $displayData->tmpl = $tmpl;
             $displayData->qs = $qs;
             $displayData->jTmplFolder = $jTmplFolder;
             $displayData->listModel = $this;
             $layout = $this->getLayout('list.fabrik-custom-css-qs');
             $path = $layout->render($displayData);
             FabrikHelperHTML::stylesheetFromPath($path);
         }
     }
 }