protected function BlockPluginCollection::initializePlugin in Drupal 9
Same name and namespace in other branches
- 8 core/modules/block/src/BlockPluginCollection.php \Drupal\block\BlockPluginCollection::initializePlugin()
Initializes and stores a plugin.
Parameters
string $instance_id: The ID of the plugin instance to initialize.
Overrides DefaultSingleLazyPluginCollection::initializePlugin
File
- core/
modules/ block/ src/ BlockPluginCollection.php, line 51
Class
- BlockPluginCollection
- Provides a collection of block plugins.
Namespace
Drupal\blockCode
protected function initializePlugin($instance_id) {
if (!$instance_id) {
throw new PluginException("The block '{$this->blockId}' did not specify a plugin.");
}
try {
parent::initializePlugin($instance_id);
} catch (PluginException $e) {
$module = $this->configuration['provider'];
// Ignore blocks belonging to uninstalled modules, but re-throw valid
// exceptions when the module is installed and the plugin is
// misconfigured.
if (!$module || \Drupal::moduleHandler()
->moduleExists($module)) {
throw $e;
}
}
}