mirror of
https://github.com/getgrav/grav.git
synced 2025-02-20 19:56:53 +01:00
#18 Refactoring per the new page events system
This commit is contained in:
parent
ecb412ea6d
commit
cb4428068d
|
|
@ -118,23 +118,23 @@ class Grav extends Container
|
|||
|
||||
$this['plugins']->init();
|
||||
|
||||
$this->fireEvent('onAfterInitPlugins');
|
||||
$this->fireEvent('onPluginsInitialized');
|
||||
|
||||
$this['assets']->init();
|
||||
|
||||
$this->fireEvent('onAfterGetAssets');
|
||||
$this->fireEvent('onAssetsInitialized');
|
||||
|
||||
$this['twig']->init();
|
||||
$this['pages']->init();
|
||||
|
||||
$this->fireEvent('onAfterGetPages');
|
||||
$this->fireEvent('onPagesInitialized');
|
||||
|
||||
$this->fireEvent('onAfterGetPage');
|
||||
$this->fireEvent('onPageInitialized');
|
||||
|
||||
// Process whole page as required
|
||||
$this->output = $this['output'];
|
||||
|
||||
$this->fireEvent('onAfterGetOutput');
|
||||
$this->fireEvent('onOutputGenerated');
|
||||
|
||||
// Set the header type
|
||||
$this->header();
|
||||
|
|
|
|||
|
|
@ -1331,7 +1331,7 @@ class Page
|
|||
$grav = self::$grav['grav'];
|
||||
|
||||
// New Custom event to handle things like pagination.
|
||||
$grav->fireEvent('onAfterCollectionProcessed', new Event(['collection' => $collection]));
|
||||
$grav->fireEvent('onCollectionProcessed', new Event(['collection' => $collection]));
|
||||
|
||||
$params = $collection->params();
|
||||
|
||||
|
|
|
|||
|
|
@ -270,7 +270,7 @@ class Pages
|
|||
}
|
||||
|
||||
if (!$blueprint->initialized) {
|
||||
$this->grav->fireEvent('onCreateBlueprint', new Event(['blueprint' => $blueprint]));
|
||||
$this->grav->fireEvent('onBlueprintCreated', new Event(['blueprint' => $blueprint]));
|
||||
$blueprint->initialized = true;
|
||||
}
|
||||
|
||||
|
|
@ -421,7 +421,7 @@ class Pages
|
|||
$page->init($file);
|
||||
|
||||
if ($config->get('system.pages.events.page')) {
|
||||
$this->grav->fireEvent('onAfterPageProcessed', new Event(['page' => $page]));
|
||||
$this->grav->fireEvent('onPageProcessed', new Event(['page' => $page]));
|
||||
}
|
||||
|
||||
} elseif ($file->isDir() && !$file->isDot()) {
|
||||
|
|
@ -448,7 +448,7 @@ class Pages
|
|||
$this->lastModified($file->getMTime());
|
||||
|
||||
if ($config->get('system.pages.events.page')) {
|
||||
$this->grav->fireEvent('onAfterFolderProcessed', new Event(['page' => $page]));
|
||||
$this->grav->fireEvent('onFolderProcessed', new Event(['page' => $page]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ class Twig
|
|||
$config = $this->grav['config'];
|
||||
|
||||
$this->twig_paths = array(THEMES_DIR . $config->get('system.pages.theme') . '/templates');
|
||||
$this->grav->fireEvent('onAfterTwigTemplatesPaths');
|
||||
$this->grav->fireEvent('onTwigTemplatePaths');
|
||||
|
||||
$this->loader = new \Twig_Loader_Filesystem($this->twig_paths);
|
||||
$this->loaderArray = new \Twig_Loader_Array(array());
|
||||
|
|
@ -79,7 +79,7 @@ class Twig
|
|||
}
|
||||
|
||||
$this->twig = new \Twig_Environment($loader_chain, $params);
|
||||
$this->grav->fireEvent('onAfterTwigInit');
|
||||
$this->grav->fireEvent('onTwigInitialized');
|
||||
|
||||
// set default date format if set in config
|
||||
if ($config->get('system.pages.dateformat.long')) {
|
||||
|
|
@ -90,7 +90,7 @@ class Twig
|
|||
$this->twig->addExtension(new \Twig_Extension_Debug());
|
||||
}
|
||||
$this->twig->addExtension(new TwigExtension());
|
||||
$this->grav->fireEvent('onAfterTwigExtensions');
|
||||
$this->grav->fireEvent('onTwigExtensions');
|
||||
|
||||
$baseUrlAbsolute = $config->get('system.base_url_absolute');
|
||||
$baseUrlRelative = $config->get('system.base_url_relative');
|
||||
|
|
@ -158,7 +158,7 @@ class Twig
|
|||
$content = $content !== null ? $content : $item->content();
|
||||
|
||||
// override the twig header vars for local resolution
|
||||
$this->grav->fireEvent('onAfterTwigPageVars');
|
||||
$this->grav->fireEvent('onTwigPageVariables');
|
||||
$twig_vars = $this->twig_vars;
|
||||
|
||||
$twig_vars['page'] = $item;
|
||||
|
|
@ -188,7 +188,7 @@ class Twig
|
|||
public function processString($string, array $vars = array())
|
||||
{
|
||||
// override the twig header vars for local resolution
|
||||
$this->grav->fireEvent('onAfterTwigVars');
|
||||
$this->grav->fireEvent('onTwigStringVariables');
|
||||
$vars += $this->twig_vars;
|
||||
|
||||
$name = '@Var:' . $string;
|
||||
|
|
@ -209,7 +209,7 @@ class Twig
|
|||
public function processSite($format = null)
|
||||
{
|
||||
// set the page now its been processed
|
||||
$this->grav->fireEvent('onAfterTwigSiteVars');
|
||||
$this->grav->fireEvent('onTwigSiteVariables');
|
||||
$twig_vars = $this->twig_vars;
|
||||
$pages = $this->grav['pages'];
|
||||
$page = $this->grav['page'];
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user