Loading src/Plugin/Block/TextBlock.php +19 −2 Original line number Diff line number Diff line Loading @@ -55,8 +55,9 @@ class TextBlock extends BlockBase implements ContainerFactoryPluginInterface { */ public function defaultConfiguration() { $default = ['text' => ['value' => NULL, 'format' => NULL]]; if ($this->moduleHandler->moduleExists('filter')) { $default['text']['format'] = filter_default_format(); $current_user = \Drupal::currentUser(); if ($this->moduleHandler->moduleExists('filter') && filter_formats($current_user)) { $default['text']['format'] = filter_default_format($current_user); } return $default + parent::defaultConfiguration(); } Loading Loading @@ -108,4 +109,20 @@ class TextBlock extends BlockBase implements ContainerFactoryPluginInterface { ]; } /** * {@inheritdoc} */ public function calculateDependencies() { $dependencies = parent::calculateDependencies(); if ($this->moduleHandler->moduleExists('filter')) { $dependencies['module'][] = 'filter'; if (isset($this->configuration['text']['format'])) { if ($config = \Drupal::entityTypeManager()->getStorage('filter_format')->load($this->configuration['text']['format'])) { $dependencies[$config->getConfigDependencyKey()][] = $config->getConfigDependencyName(); } } } return $dependencies; } } Loading
src/Plugin/Block/TextBlock.php +19 −2 Original line number Diff line number Diff line Loading @@ -55,8 +55,9 @@ class TextBlock extends BlockBase implements ContainerFactoryPluginInterface { */ public function defaultConfiguration() { $default = ['text' => ['value' => NULL, 'format' => NULL]]; if ($this->moduleHandler->moduleExists('filter')) { $default['text']['format'] = filter_default_format(); $current_user = \Drupal::currentUser(); if ($this->moduleHandler->moduleExists('filter') && filter_formats($current_user)) { $default['text']['format'] = filter_default_format($current_user); } return $default + parent::defaultConfiguration(); } Loading Loading @@ -108,4 +109,20 @@ class TextBlock extends BlockBase implements ContainerFactoryPluginInterface { ]; } /** * {@inheritdoc} */ public function calculateDependencies() { $dependencies = parent::calculateDependencies(); if ($this->moduleHandler->moduleExists('filter')) { $dependencies['module'][] = 'filter'; if (isset($this->configuration['text']['format'])) { if ($config = \Drupal::entityTypeManager()->getStorage('filter_format')->load($this->configuration['text']['format'])) { $dependencies[$config->getConfigDependencyKey()][] = $config->getConfigDependencyName(); } } } return $dependencies; } }