Skip to content
Snippets Groups Projects
Commit f0a7c35c authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2069619 by rpayanm, tstoeckler: Remove the module handler dependency from BlockContentBlock.

parent 46e6a329
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -43,13 +43,6 @@ class BlockContentBlock extends BlockBase implements ContainerFactoryPluginInter
*/
protected $entityManager;
/**
* The Module Handler.
*
* @var \Drupal\Core\Extension\ModuleHandlerInterface.
*/
protected $moduleHandler;
/**
* The Drupal account to use for checking for access to block.
*
......@@ -70,17 +63,14 @@ class BlockContentBlock extends BlockBase implements ContainerFactoryPluginInter
* The Plugin Block Manager.
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager service.
* @param \Drupal\Core\Extension\ModuleHandlerInterface
* The Module Handler.
* @param \Drupal\Core\Session\AccountInterface $account
* The account for which view access should be checked.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, BlockManagerInterface $block_manager, EntityManagerInterface $entity_manager, ModuleHandlerInterface $module_handler, AccountInterface $account, UrlGeneratorInterface $url_generator) {
public function __construct(array $configuration, $plugin_id, $plugin_definition, BlockManagerInterface $block_manager, EntityManagerInterface $entity_manager, AccountInterface $account, UrlGeneratorInterface $url_generator) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->blockManager = $block_manager;
$this->entityManager = $entity_manager;
$this->moduleHandler = $module_handler;
$this->account = $account;
$this->urlGenerator = $url_generator;
}
......@@ -95,7 +85,6 @@ public static function create(ContainerInterface $container, array $configuratio
$plugin_definition,
$container->get('plugin.manager.block'),
$container->get('entity.manager'),
$container->get('module_handler'),
$container->get('current_user'),
$container->get('url_generator')
);
......@@ -140,10 +129,8 @@ public function blockForm($form, FormStateInterface $form_state) {
*/
public function blockSubmit($form, FormStateInterface $form_state) {
// Invalidate the block cache to update custom block-based derivatives.
if ($this->moduleHandler->moduleExists('block')) {
$this->configuration['view_mode'] = $form_state->getValue('view_mode');
$this->blockManager->clearCachedDefinitions();
}
$this->configuration['view_mode'] = $form_state->getValue('view_mode');
$this->blockManager->clearCachedDefinitions();
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment