Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. BlockPluginCollection.php

function BlockPluginCollection::initializePlugin

Overrides DefaultSingleLazyPluginCollection::initializePlugin

File

core/modules/block/src/BlockPluginCollection.php, line 51

Class

BlockPluginCollection
Provides a collection of block plugins.

Namespace

Drupal\block

Code

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;
        }
    }
}
RSS feed
Powered by Drupal