Skip to content
Snippets Groups Projects
Commit 6a9e3fb0 authored by catch's avatar catch
Browse files

Issue #2170435 by Xano, EclipseGc: PluginManagerBase::processDefinition()...

Issue #2170435 by Xano, EclipseGc: PluginManagerBase::processDefinition() fails when plugin definitions are not arrays.
parent eb4a2a97
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -7,7 +7,6 @@
namespace Drupal\Component\Plugin;
use Drupal\Component\Utility\NestedArray;
use Drupal\Component\Plugin\Discovery\CachedDiscoveryInterface;
/**
......@@ -36,15 +35,6 @@ abstract class PluginManagerBase implements PluginManagerInterface, CachedDiscov
*/
protected $mapper;
/**
* A set of defaults to be referenced by $this->processDefinition() if
* additional processing of plugins is necessary or helpful for development
* purposes.
*
* @var array
*/
protected $defaults = array();
/**
* {@inheritdoc}
*/
......@@ -82,15 +72,4 @@ public function getInstance(array $options) {
return $this->mapper->getInstance($options);
}
/**
* Performs extra processing on plugin definitions.
*
* By default we add defaults for the type to the definition. If a type has
* additional processing logic they can do that by replacing or extending the
* method.
*/
public function processDefinition(&$definition, $plugin_id) {
$definition = NestedArray::mergeDeep($this->defaults, $definition);
}
}
......@@ -89,6 +89,15 @@ class DefaultPluginManager extends PluginManagerBase implements PluginManagerInt
*/
protected $languageManager;
/**
* A set of defaults to be referenced by $this->processDefinition() if
* additional processing of plugins is necessary or helpful for development
* purposes.
*
* @var array
*/
protected $defaults = array();
/**
* Creates the discovery object.
*
......@@ -230,6 +239,20 @@ protected function setCachedDefinitions($definitions) {
$this->definitions = $definitions;
}
/**
* Performs extra processing on plugin definitions.
*
* By default we add defaults for the type to the definition. If a type has
* additional processing logic they can do that by replacing or extending the
* method.
*/
public function processDefinition(&$definition, $plugin_id) {
if (!empty($this->defaults) && is_array($this->defaults)) {
$definition = NestedArray::mergeDeep($this->defaults, $definition);
}
}
/**
* Finds plugin definitions.
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment