X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fviews%2Fsrc%2FPlugin%2Fviews%2Fdisplay%2FBlock.php;fp=web%2Fcore%2Fmodules%2Fviews%2Fsrc%2FPlugin%2Fviews%2Fdisplay%2FBlock.php;h=e210ee3231ab32ef941df9d39cfdbee11936440c;hp=5e833d752a5776d7377c6ba7357148ae81397176;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hpb=74df008bdbb3a11eeea356744f39b802369bda3c diff --git a/web/core/modules/views/src/Plugin/views/display/Block.php b/web/core/modules/views/src/Plugin/views/display/Block.php index 5e833d752..e210ee323 100644 --- a/web/core/modules/views/src/Plugin/views/display/Block.php +++ b/web/core/modules/views/src/Plugin/views/display/Block.php @@ -2,6 +2,8 @@ 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; @@ -42,6 +44,13 @@ class Block extends DisplayPluginBase { */ protected $entityManager; + /** + * The block manager. + * + * @var \Drupal\Core\Block\BlockManagerInterface + */ + protected $blockManager; + /** * Constructs a new Block instance. * @@ -53,11 +62,14 @@ class Block extends DisplayPluginBase { * 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; } /** @@ -68,7 +80,8 @@ class Block extends DisplayPluginBase { $configuration, $plugin_id, $plugin_definition, - $container->get('entity.manager') + $container->get('entity.manager'), + $container->get('plugin.manager.block') ); } @@ -364,6 +377,9 @@ class Block extends DisplayPluginBase { $block->delete(); } } + if ($this->blockManager instanceof CachedDiscoveryInterface) { + $this->blockManager->clearCachedDefinitions(); + } } }