diff --git a/core/lib/Drupal/Core/Block/Plugin/Block/Broken.php b/core/lib/Drupal/Core/Block/Plugin/Block/Broken.php index 0e4732e..d71c50e 100644 --- a/core/lib/Drupal/Core/Block/Plugin/Block/Broken.php +++ b/core/lib/Drupal/Core/Block/Plugin/Block/Broken.php @@ -20,7 +20,14 @@ class Broken extends BlockBase { * {@inheritdoc} */ public function build() { - return $this->brokenMessage(); + + if (\Drupal::currentUser()->hasPermission('administer blocks')) { + $build = $this->brokenMessage(); + } + else { + $build = $this->brokenMessageGeneral(); + } + return $build; } /** @@ -38,10 +45,23 @@ public function blockForm($form, FormStateInterface $form_state) { */ protected function brokenMessage() { $build['message'] = [ - '#markup' => $this->t('This block is broken or missing. You may be missing content or you might need to enable the original module.') + '#markup' => $this->t('This block is broken or missing. You may be missing content or you might need to enable the original module.'), ]; return $build; } + /** + * General message without debugging information for broken block. + * + * @return array + * Render array containing debug information. + */ + protected function brokenMessageGeneral() { + $build['message'] = [ + '#markup' => $this->t('Something goes wrong with $label section.', ['%label' => $this->label()]) + ]; + return $build; + } + }