diff --git a/core/modules/block/lib/Drupal/block/BlockPluginBag.php b/core/modules/block/lib/Drupal/block/BlockPluginBag.php index 12bca82..e71fcca 100644 --- a/core/modules/block/lib/Drupal/block/BlockPluginBag.php +++ b/core/modules/block/lib/Drupal/block/BlockPluginBag.php @@ -8,6 +8,7 @@ namespace Drupal\block; use Drupal\Component\Plugin\Exception\PluginException; +use Drupal\Component\Plugin\PluginManagerInterface; use Drupal\Core\Plugin\DefaultSinglePluginBag; /** @@ -16,11 +17,27 @@ class BlockPluginBag extends DefaultSinglePluginBag { /** + * The block ID this plugin bag belongs to. + * + * @var string + */ + protected $blockId; + + /** + * {@inheritdoc} + */ + public function __construct(PluginManagerInterface $manager, array $instance_ids, array $configuration, $block_id) { + parent::__construct($manager, $instance_ids, $configuration); + + $this->blockId = $block_id; + } + + /** * {@inheritdoc} */ protected function initializePlugin($instance_id) { if (!$instance_id) { - throw new PluginException(format_string("The block '@block' did not specify a plugin.", array('@block' => $this->configuration['id']))); + throw new PluginException(format_string("The block '@block' did not specify a plugin.", array('@block' => $this->blockId))); } try { diff --git a/core/modules/block/lib/Drupal/block/Plugin/Core/Entity/Block.php b/core/modules/block/lib/Drupal/block/Plugin/Core/Entity/Block.php index 25f6b39..ac87707 100644 --- a/core/modules/block/lib/Drupal/block/Plugin/Core/Entity/Block.php +++ b/core/modules/block/lib/Drupal/block/Plugin/Core/Entity/Block.php @@ -105,9 +105,7 @@ class Block extends ConfigEntityBase implements BlockInterface { public function __construct(array $values, $entity_type) { parent::__construct($values, $entity_type); - $settings = $this->get('settings'); - $settings['id'] = $this->id(); - $this->pluginBag = new BlockPluginBag(\Drupal::service('plugin.manager.block'), array($this->plugin), $settings); + $this->pluginBag = new BlockPluginBag(\Drupal::service('plugin.manager.block'), array($this->plugin), $this->get('settings'), $this->id()); } /**