Skip to content

Commit

Permalink
Merge branch 'release/1.7.22'
Browse files Browse the repository at this point in the history
  • Loading branch information
rhukster committed Sep 16, 2021
2 parents f3c82f8 + c5fd282 commit f2d30e3
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 7 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# v1.7.22
## 09/16/2021

1. [](#new)
* Register plugin autoloaders into plugin objects
1. [](#bugfix)
* Fixed conflicting `$_original` variable in `Flex Pages`

# v1.7.21
## 09/14/2021

Expand Down
2 changes: 1 addition & 1 deletion system/defines.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

// Some standard defines
define('GRAV', true);
define('GRAV_VERSION', '1.7.21');
define('GRAV_VERSION', '1.7.22');
define('GRAV_SCHEMA', '1.7.0_2020-11-20_1');
define('GRAV_TESTING', false);

Expand Down
2 changes: 1 addition & 1 deletion system/src/Grav/Common/Flex/Types/Pages/PageObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ public function save($reorder = true)
}

// Reset original after save events have all been called.
$this->_original = null;
$this->_originalObject = null;

return $instance;
}
Expand Down
21 changes: 21 additions & 0 deletions system/src/Grav/Common/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
namespace Grav\Common;

use ArrayAccess;
use Composer\Autoload\ClassLoader;
use Grav\Common\Data\Blueprint;
use Grav\Common\Data\Data;
use Grav\Common\Page\Interfaces\PageInterface;
Expand Down Expand Up @@ -42,6 +43,8 @@ class Plugin implements EventSubscriberInterface, ArrayAccess
protected $active = true;
/** @var Blueprint|null */
protected $blueprint;
/** @var ClassLoader|null */
protected $loader;

/**
* By default assign all methods as listeners using the default priority.
Expand Down Expand Up @@ -79,6 +82,24 @@ public function __construct($name, Grav $grav, Config $config = null)
}
}

/**
* @return ClassLoader|null
* @internal
*/
final public function getAutoloader(): ?ClassLoader
{
return $this->loader;
}

/**
* @param ClassLoader|null $loader
* @internal
*/
final public function setAutoloader(?ClassLoader $loader): void
{
$this->loader = $loader;
}

/**
* @param Config $config
* @return $this
Expand Down
2 changes: 1 addition & 1 deletion system/src/Grav/Common/Plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public function init()
$instance->setConfig($config);
// Register autoloader.
if (method_exists($instance, 'autoload')) {
$instance->autoload();
$instance->setAutoloader($instance->autoload());
}
// Register event listeners.
$events->addSubscriber($instance);
Expand Down
8 changes: 4 additions & 4 deletions system/src/Grav/Framework/Flex/Pages/FlexPageObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class FlexPageObject extends FlexObject implements PageInterface, FlexTranslateI
/** @var array|null */
protected $_reorder;
/** @var FlexPageObject|null */
protected $_original;
protected $_originalObject;

/**
* Clone page.
Expand Down Expand Up @@ -264,7 +264,7 @@ public function save($reorder = true)
*/
public function getOriginal()
{
return $this->_original;
return $this->_originalObject;
}

/**
Expand All @@ -276,8 +276,8 @@ public function getOriginal()
*/
public function storeOriginal(): void
{
if (null === $this->_original) {
$this->_original = clone $this;
if (null === $this->_originalObject) {
$this->_originalObject = clone $this;
}
}

Expand Down

0 comments on commit f2d30e3

Please sign in to comment.