public static function getTypes()
    {
        if (!self::$types) {
            $grav = Grav::instance();

            $scanBlueprintsAndTemplates = function () use ($grav) {
                // Scan blueprints
                $event = new Event();
                $event->types = self::$types;
                $grav->fireEvent('onGetPageBlueprints', $event);

                self::$types->scanBlueprints('theme://blueprints/');

                // Scan templates
                $event = new Event();
                $event->types = self::$types;
                $grav->fireEvent('onGetPageTemplates', $event);

                self::$types->scanTemplates('theme://templates/');
            };

            if ($grav['config']->get('system.cache.enabled')) {
                /** @var Cache $cache */
                $cache = $grav['cache'];

                // Use cached types if possible.
                $types_cache_id = md5('types');
                self::$types = $cache->fetch($types_cache_id);

                if (!self::$types) {
                    self::$types = new Types();
                    $scanBlueprintsAndTemplates();
                    $cache->save($types_cache_id, self::$types);
                }

            } else {
                self::$types = new Types();
                $scanBlueprintsAndTemplates();
            }

            // Register custom paths to the locator.
            $locator = $grav['locator'];
            foreach (self::$types as $type => $paths) {
                foreach ($paths as $k => $path) {
                    if (strpos($path, 'blueprints://') === 0) {
                        unset($paths[$k]);
                    }
                }
                if ($paths) {
                    $locator->addPath('blueprints', "pages/$type.yaml", $paths);
                }
            }
        }

        return self::$types;
    }
public static function getTypes()
    {
        if (!self::$types) {
            $grav = Grav::instance();

            $scanBlueprintsAndTemplates = function () use ($grav) {
                // Scan blueprints
                $event = new Event();
                $event->types = self::$types;
                $grav->fireEvent('onGetPageBlueprints', $event);

                self::$types->scanBlueprints('theme://blueprints/');

                // Scan templates
                $event = new Event();
                $event->types = self::$types;
                $grav->fireEvent('onGetPageTemplates', $event);

                self::$types->scanTemplates('theme://templates/');
            };

            if ($grav['config']->get('system.cache.enabled')) {
                /** @var Cache $cache */
                $cache = $grav['cache'];

                // Use cached types if possible.
                $types_cache_id = md5('types');
                self::$types = $cache->fetch($types_cache_id);

                if (!self::$types) {
                    self::$types = new Types();
                    $scanBlueprintsAndTemplates();
                    $cache->save($types_cache_id, self::$types);
                }

            } else {
                self::$types = new Types();
                $scanBlueprintsAndTemplates();
            }

            // Register custom paths to the locator.
            $locator = $grav['locator'];
            foreach (self::$types as $type => $paths) {
                foreach ($paths as $k => $path) {
                    if (strpos($path, 'blueprints://') === 0) {
                        unset($paths[$k]);
                    }
                }
                if ($paths) {
                    $locator->addPath('blueprints', "pages/$type.yaml", $paths);
                }
            }
        }

        return self::$types;
    }
public static function getTypes ( ) { if ( ! self :: $ types ) { $ grav = Grav :: instance ( ) ; $ scanBlueprintsAndTemplates = function ( ) use ( $ grav ) { // Scan blueprints $ event = new Event ( ) ; $ event -> types = self :: $ types ; $ grav -> fireEvent ( 'onGetPageBlueprints' , $ event ) ; self :: $ types -> scanBlueprints ( 'theme://blueprints/' ) ; // Scan templates $ event = new Event ( ) ; $ event -> types = self :: $ types ; $ grav -> fireEvent ( 'onGetPageTemplates' , $ event ) ; self :: $ types -> scanTemplates ( 'theme://templates/' ) ; } ; if ( $ grav [ 'config' ] -> get ( 'system.cache.enabled' ) ) { /** @var Cache $cache */ $ cache = $ grav [ 'cache' ] ; // Use cached types if possible. $ types_cache_id = md5 ( 'types' ) ; self :: $ types = $ cache -> fetch ( $ types_cache_id ) ; if ( ! self :: $ types ) { self :: $ types = new Types ( ) ; $ scanBlueprintsAndTemplates ( ) ; $ cache -> save ( $ types_cache_id , self :: $ types ) ; } } else { self :: $ types = new Types ( ) ; $ scanBlueprintsAndTemplates ( ) ; } // Register custom paths to the locator. $ locator = $ grav [ 'locator' ] ; foreach ( self :: $ types as $ type => $ paths ) { foreach ( $ paths as $ k => $ path ) { if ( strpos ( $ path , 'blueprints://' ) === 0 ) { unset ( $ paths [ $ k ] ) ; } } if ( $ paths ) { $ locator -> addPath ( 'blueprints' , "pages/$type.yaml" , $ paths ) ; } } } return self :: $ types ; }
Get available page types.

@return Types
Get available page types .