mirror of
https://github.com/getgrav/grav.git
synced 2026-07-07 05:11:49 +02:00
Fixed Pages::instances() returning null values when using Flex Pages [#2889]
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
* Support symlinks when saving `File`
|
||||
1. [](#bugfix)
|
||||
* Fixed flex objects with integer keys not working [#2863](https://github.com/getgrav/grav/issues/2863)
|
||||
* Fixed `Pages::instances()` returning null values when using `Flex Pages` [#2889](https://github.com/getgrav/grav/issues/2889)
|
||||
* Fixed user avatar creation for new `Flex Users` when using folder storage
|
||||
* Fixed `Trying to access array offset on value of type null` PHP 7.4 error in `Plugin.php`
|
||||
* Fixed Gregwar Image library using `.jpeg` for cached images, rather use `.jpg`
|
||||
|
||||
@@ -748,12 +748,20 @@ class Pages
|
||||
$instance = $this->index[$path] ?? null;
|
||||
if (\is_string($instance)) {
|
||||
$instance = $this->directory ? $this->directory->getObject($instance, 'flex_key') : null;
|
||||
if ($instance && $this->fire_events && method_exists($instance, 'initialize')) {
|
||||
$instance->initialize();
|
||||
if ($instance) {
|
||||
if ($this->fire_events && method_exists($instance, 'initialize')) {
|
||||
$instance->initialize();
|
||||
}
|
||||
} else {
|
||||
/** @var Debugger $debugger */
|
||||
$debugger = $this->grav['debugger'];
|
||||
$debugger->addMessage(sprintf('Flex page %s is missing or broken!', $instance), 'debug');
|
||||
}
|
||||
}
|
||||
|
||||
$this->instances[$path] = $instance;
|
||||
if ($instance) {
|
||||
$this->instances[$path] = $instance;
|
||||
}
|
||||
|
||||
return $instance;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user