/** * {@inheritdoc} */ public function remove() { parent::remove(); if ($this->entityManager->hasDefinition('block')) { $plugin_id = 'views_block:' . $this->view->storage->id() . '-' . $this->display['id']; foreach ($this->entityManager->getStorage('block')->loadByProperties(['plugin' => $plugin_id]) as $block) { $block->delete(); } } }
/** * Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::remove(). */ public function remove() { parent::remove(); $plugin_id = 'views_block:' . $this->view->storage->id() . '-' . $this->display['id']; foreach (entity_load_multiple_by_properties('block', array('plugin' => $plugin_id)) as $block) { $block->delete(); } }