Created
August 21, 2017 06:13
-
-
Save sminnee/1cfbf4f98912ba854c75e2ffd627ff3b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/src/Core/CustomMethods.php b/src/Core/CustomMethods.php | |
| index f37be48..749b4d0 100644 | |
| --- a/src/Core/CustomMethods.php | |
| +++ b/src/Core/CustomMethods.php | |
| @@ -61,6 +61,10 @@ trait CustomMethods | |
| switch (true) { | |
| case isset($config['property']) : { | |
| + if (!empty($config['callSetOwnerFirst']) && !isset($this->{$config['property']})) { | |
| + $this->getExtensionInstances(); | |
| + } | |
| + | |
| $obj = $config['index'] !== null ? | |
| $this->{$config['property']}[$config['index']] : | |
| $this->{$config['property']}; | |
| diff --git a/src/Core/Extensible.php b/src/Core/Extensible.php | |
| index cfc0310..1f84c3c 100644 | |
| --- a/src/Core/Extensible.php | |
| +++ b/src/Core/Extensible.php | |
| @@ -17,19 +17,7 @@ use SilverStripe\View\ViewableData; | |
| */ | |
| trait Extensible | |
| { | |
| - use CustomMethods { | |
| - getExtraMethodConfig as getCustomMethodsConfig; | |
| - } | |
| - | |
| - protected function getExtraMethodConfig($method) | |
| - { | |
| - $config = $this->getCustomMethodsConfig($method); | |
| - // Ensure extension instances are populated before being accessed | |
| - if (isset($config['property']) && $config['property'] === 'extension_instances') { | |
| - $this->getExtensionInstances(); | |
| - } | |
| - return $config; | |
| - } | |
| + use CustomMethods; | |
| /** | |
| * An array of extension names and parameters to be applied to this object upon construction. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment