Example #1
0
 public function __construct($container)
 {
     parent::__construct($container);
     $app = \JFactory::getApplication();
     $document = \JFactory::getDocument();
     $input = $app->input;
     $this->tmpl = $input->getCmd('tmpl', '');
     $this->option = $input->getCmd('option', '');
     $this->view = $input->getCmd('view', '');
     $this->layout = $input->getCmd('layout', '');
     $this->task = $input->getCmd('task', '');
     $this->itemid = $input->getCmd('Itemid', '');
     $this->printing = $input->getCmd('print', '');
     $this->class = '';
     if ($this->itemid) {
         $menuItem = $app->getMenu()->getActive();
         if ($menuItem && $menuItem->id) {
             $this->class = $menuItem->params->get('pageclass_sfx', '');
         }
     }
     $templateParams = $app->getTemplate(true);
     $this->outline = Gantry::instance()['configuration'];
     $this->sitename = $app->get('sitename');
     $this->theme = $templateParams->template;
     $this->baseUrl = \JUri::base(true);
     $this->title = $document->title;
     $this->description = $document->description;
     $this->language = $document->language;
     $this->direction = $document->direction;
 }
Example #2
0
 public static function getInstance()
 {
     if (!self::$instance) {
         self::$instance = new Gantry();
     }
     return self::$instance;
 }
Example #3
0
 public function htmlAttributes()
 {
     $site = Gantry::instance()['site'];
     $dir = [];
     if (function_exists('is_rtl') && is_rtl()) {
         $dir['dir'] = 'rtl';
     }
     $attributes = ['lang' => (string) $site->language] + (array) $dir + (array) $this->config->get('page.html', []);
     return $this->getAttributes($attributes);
 }
Example #4
0
 public function bodyAttributes($attributes = [])
 {
     // TODO: we might need something like
     // class="{{body_class}}" data-template="{{ twigTemplate|default('base.twig') }}"
     $body_classes = apply_filters('gantry5_body_classes', ['site', 'outline-' . Gantry::instance()['configuration']]);
     is_rtl() ? $body_classes[] = 'dir-rtl' : ($body_classes[] = 'dir-ltr');
     $wp_body_class = get_body_class($body_classes);
     if (is_array($wp_body_class) && !empty($wp_body_class)) {
         $attributes['class'] = array_merge_recursive($attributes['class'], $wp_body_class);
     }
     return $this->getAttributes((array) $this->config->get('page.body.attribs'), $attributes);
 }
Example #5
0
 public function htmlAttributes()
 {
     $site = Gantry::instance()['site'];
     $attributes = ['lang' => (string) $site->language] + (array) $this->config->get('page.html', []);
     return $this->getAttributes($attributes);
 }
Example #6
0
<?php

namespace Gantry\Framework;

/** @var $locator */
/** @var $path */
if (!class_exists('\\Gantry5\\Loader')) {
    throw new \LogicException('Please install Gantry 5 Framework plugin!');
}
// Setup Gantry 5 Framework or throw exception.
\Gantry5\Loader::setup();
// Get Gantry instance.
$gantry = Gantry::instance();
// Set the theme path from Grav variable.
$gantry['theme.path'] = $locator('theme://');
$gantry['theme.name'] = basename($gantry['theme.path']);
// Initialize theme stream.
$gantry['platform']->set('streams.gantry-theme.prefixes', ['' => ["gantry-themes://{$gantry['theme.name']}/custom", "gantry-themes://{$gantry['theme.name']}", "gantry-themes://{$gantry['theme.name']}/common"]]);
$gantry['streams'];
return $gantry;