mirror of
https://github.com/getgrav/grav.git
synced 2026-05-07 05:15:58 +02:00
Fixed Flex Pages not calling onPageProcessed event when cached
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
1. [](#bugfix)
|
||||
* Fixed `Page::untranslatedLanguages()` not being symmetrical to `Page::translatedLanguages()`
|
||||
* Fixed `Flex Pages` not calling `onPageProcessed` event when cached
|
||||
|
||||
# v1.7.0-beta.10
|
||||
## 10/03/2019
|
||||
|
||||
@@ -702,7 +702,12 @@ class Pages
|
||||
$instance = $this->instances[(string)$path] ?? null;
|
||||
if (\is_string($instance)) {
|
||||
$instance = $this->flex ? $this->flex->getObject($instance) : null;
|
||||
$instance = $instance->hasTranslation() ? $instance->getTranslation() : $instance;
|
||||
if ($instance) {
|
||||
$instance = $instance->hasTranslation() ? $instance->getTranslation() : $instance;
|
||||
if (method_exists($instance, 'initialize') && $this->grav['config']->get('system.pages.events.page')) {
|
||||
$instance->initialize();
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($instance && !$instance instanceof PageInterface) {
|
||||
throw new \RuntimeException('Routing failed on unknown type', 500);
|
||||
@@ -1325,7 +1330,12 @@ class Pages
|
||||
*/
|
||||
foreach ($collection as $key => $page) {
|
||||
if ($config->get('system.pages.events.page')) {
|
||||
$this->grav->fireEvent('onPageProcessed', new Event(['page' => $page]));
|
||||
if (method_exists($page, 'initialize')) {
|
||||
$page->initialize();
|
||||
} else {
|
||||
// TODO: Deprecated, only used in 1.7 betas.
|
||||
$this->grav->fireEvent('onPageProcessed', new Event(['page' => $page]));
|
||||
}
|
||||
}
|
||||
|
||||
$path = $page->path();
|
||||
|
||||
@@ -170,6 +170,7 @@ class PageSystemValidatorCommand extends ConsoleCommand
|
||||
// Pages
|
||||
$grav['pages']->init();
|
||||
$grav->fireEvent('onPagesInitialized', new Event(['pages' => $grav['pages']]));
|
||||
$grav->fireEvent('onPageInitialized', new Event(['page' => $grav['page']]));
|
||||
|
||||
if ($this->input->getOption('record')) {
|
||||
$this->output->writeln('Pages: ' . $config->get('system.pages.type', 'page'));
|
||||
|
||||
Reference in New Issue
Block a user