diff --git a/core/modules/block/block.module b/core/modules/block/block.module index 222d09a..f81f2ed 100644 --- a/core/modules/block/block.module +++ b/core/modules/block/block.module @@ -531,6 +531,11 @@ function template_preprocess_block(&$variables) { $block_counter = &drupal_static(__FUNCTION__, array()); $variables['block'] = (object) $variables['elements']['#block_config']; + // If the block title is configured to be hidden, set it to an empty string. + if (empty($variables['elements']['#block']->display_title)) { + $variables['block']->hidden_title = $variables['block']->subject; + $variables['block']->subject = ''; + } // All blocks get an independent counter for each region. if (!isset($block_counter[$variables['block']->region])) { diff --git a/core/modules/block/lib/Drupal/block/BlockBase.php b/core/modules/block/lib/Drupal/block/BlockBase.php index 9e5bf6c..235f721 100644 --- a/core/modules/block/lib/Drupal/block/BlockBase.php +++ b/core/modules/block/lib/Drupal/block/BlockBase.php @@ -239,6 +239,12 @@ public function form($form, &$form_state) { '#title' => t('Title'), '#maxlength' => 255, '#default_value' => !$entity->isNew() ? $entity->label() : $definition['subject'], + '#required' => TRUE, + ); + $form['display_title'] = array( + '#type' => 'checkbox', + '#title' => t('Display title'), + '#default_value' => $entity->display_title, ); $form['machine_name'] = array( '#type' => 'machine_name', diff --git a/core/modules/block/lib/Drupal/block/Plugin/Core/Entity/Block.php b/core/modules/block/lib/Drupal/block/Plugin/Core/Entity/Block.php index d2bf1a7..8680bf4 100644 --- a/core/modules/block/lib/Drupal/block/Plugin/Core/Entity/Block.php +++ b/core/modules/block/lib/Drupal/block/Plugin/Core/Entity/Block.php @@ -53,6 +53,13 @@ class Block extends ConfigEntityBase { public $label; /** + * Whether the label should be displayed. + * + * @var boolean + */ + public $display_title = TRUE; + + /** * The block UUID. * * @var string @@ -169,6 +176,7 @@ public function getExportProperties() { $names = array( 'id', 'label', + 'display_title', 'uuid', 'region', 'weight',