Commit 3d7cd4ed authored by alexpott's avatar alexpott

Issue #2480307 by camoa: DefaultPluginManager doesn't allow Plugin definitions from Themes

parent 249e520b
......@@ -271,7 +271,7 @@ protected function findDefinitions() {
if (is_object($plugin_definition) && !($plugin_definition = (array) $plugin_definition)) {
continue;
}
if (isset($plugin_definition['provider']) && !in_array($plugin_definition['provider'], array('core', 'component')) && !$this->moduleHandler->moduleExists($plugin_definition['provider'])) {
if (isset($plugin_definition['provider']) && !in_array($plugin_definition['provider'], array('core', 'component')) && !$this->providerExists($plugin_definition['provider'])) {
unset($definitions[$plugin_id]);
}
}
......@@ -290,4 +290,14 @@ protected function alterDefinitions(&$definitions) {
}
}
/**
* Determines if the provider of a definition exists.
*
* @return boolean
* TRUE if provider exists, FALSE otherwise.
*/
protected function providerExists($provider) {
return $this->moduleHandler->moduleExists($provider);
}
}
......@@ -136,28 +136,8 @@ public function processDefinition(&$definition, $plugin_id) {
/**
* {@inheritdoc}
*/
protected function findDefinitions() {
$definitions = $this->discovery->getDefinitions();
foreach ($definitions as $plugin_id => &$definition) {
$this->processDefinition($definition, $plugin_id);
}
if ($this->alterHook) {
$this->moduleHandler->alter($this->alterHook, $definitions);
}
// If this plugin was provided by a module that does not exist, remove the
// plugin definition.
foreach ($definitions as $plugin_id => $plugin_definition) {
// If the plugin definition is an object, attempt to convert it to an
// array, if that is not possible, skip further processing.
if (is_object($plugin_definition) && !($plugin_definition = (array) $plugin_definition)) {
continue;
}
// Allow themes to provide breakpoints.
if (isset($plugin_definition['provider']) && !in_array($plugin_definition['provider'], array('core', 'component')) && !$this->moduleHandler->moduleExists($plugin_definition['provider']) && !$this->themeHandler->themeExists($plugin_definition['provider'])) {
unset($definitions[$plugin_id]);
}
}
return $definitions;
protected function providerExists($provider) {
return $this->moduleHandler->moduleExists($provider) || $this->themeHandler->themeExists($provider);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment