Ejemplo n.º 1
0
 /**
  * Get's the home route
  *
  * @return string
  */
 public static function getHomeRoute()
 {
     if (empty(self::$home)) {
         $grav = Grav::instance();
         /** @var Config $config */
         $config = $grav['config'];
         /** @var Language $language */
         $language = $grav['language'];
         $home = $config->get('system.home.alias');
         if ($language->enabled()) {
             $home_aliases = $config->get('system.home.aliases');
             if ($home_aliases) {
                 $active = $language->getActive();
                 $default = $language->getDefault();
                 try {
                     if ($active) {
                         $home = $home_aliases[$active];
                     } else {
                         $home = $home_aliases[$default];
                     }
                 } catch (ErrorException $e) {
                     $home = $home_aliases[$default];
                 }
             }
         }
         self::$home_route = trim($home, '/');
     }
     return self::$home_route;
 }
Ejemplo n.º 2
0
 /**
  * Get available page types.
  *
  * @return Types
  */
 public static function getTypes()
 {
     if (!self::$types) {
         self::$types = new Types();
         self::$types->scanBlueprints('theme://blueprints/');
         self::$types->scanTemplates('theme://templates/');
         $event = new Event();
         $event->types = self::$types;
         Grav::instance()->fireEvent('onGetPageTemplates', $event);
     }
     return self::$types;
 }
Ejemplo n.º 3
0
 /**
  * Needed for testing where we change the home route via config
  */
 public static function resetHomeRoute()
 {
     self::$home_route = null;
     return self::getHomeRoute();
 }