namespace Drupal\views\Plugin\views\display;
+use Drupal\Component\Plugin\Discovery\CachedDiscoveryInterface;
+use Drupal\Core\Block\BlockManagerInterface;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Plugin\Block\ViewsBlock;
*/
protected $entityManager;
+ /**
+ * The block manager.
+ *
+ * @var \Drupal\Core\Block\BlockManagerInterface
+ */
+ protected $blockManager;
+
/**
* Constructs a new Block instance.
*
* The plugin implementation definition.
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager.
+ * @param \Drupal\Core\Block\BlockManagerInterface $block_manager
+ * The block manager.
*/
- public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityManagerInterface $entity_manager) {
+ public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityManagerInterface $entity_manager, BlockManagerInterface $block_manager) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->entityManager = $entity_manager;
+ $this->blockManager = $block_manager;
}
/**
$configuration,
$plugin_id,
$plugin_definition,
- $container->get('entity.manager')
+ $container->get('entity.manager'),
+ $container->get('plugin.manager.block')
);
}
$block->delete();
}
}
+ if ($this->blockManager instanceof CachedDiscoveryInterface) {
+ $this->blockManager->clearCachedDefinitions();
+ }
}
}