From 530c4c45418417ba9e8c375599f73bce3de89e5c Mon Sep 17 00:00:00 2001 From: webchick Date: Fri, 1 Feb 2013 18:18:51 -0800 Subject: [PATCH] Issue #1899910 by tim.plunkett: Fixed Regression: Views blocks should not have an editable label. --- .../Drupal/block/Tests/Views/DisplayBlockTest.php | 11 +++++++++++ .../Drupal/views/Plugin/block/block/ViewsBlock.php | 12 +++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/core/modules/block/lib/Drupal/block/Tests/Views/DisplayBlockTest.php b/core/modules/block/lib/Drupal/block/Tests/Views/DisplayBlockTest.php index c9ee6ed2a9d..77496518cec 100644 --- a/core/modules/block/lib/Drupal/block/Tests/Views/DisplayBlockTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/Views/DisplayBlockTest.php @@ -137,4 +137,15 @@ class DisplayBlockTest extends ViewTestBase { $this->assertBlockAppears($block_4); } + /** + * Test the block form for a Views block. + */ + public function testViewsBlockForm() { + $this->drupalLogin($this->drupalCreateUser(array('administer blocks'))); + $default_theme = variable_get('theme_default', 'stark'); + $this->drupalGet('admin/structure/block/add/views_block:test_view_block-block_1/' . $default_theme); + $elements = $this->xpath('//input[@name="label"]'); + $this->assertTrue(empty($elements), 'The label field is not found for Views blocks.'); + } + } diff --git a/core/modules/views/lib/Drupal/views/Plugin/block/block/ViewsBlock.php b/core/modules/views/lib/Drupal/views/Plugin/block/block/ViewsBlock.php index 6eaef357830..7cac4f68e95 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/block/block/ViewsBlock.php +++ b/core/modules/views/lib/Drupal/views/Plugin/block/block/ViewsBlock.php @@ -60,12 +60,14 @@ class ViewsBlock extends BlockBase { } /** - * Overrides \Drupal\block\BlockBase::blockForm(). + * Overrides \Drupal\block\BlockBase::form(). */ - public function blockForm($form, &$form_state) { - // Set the default subject to '' so the views internal title is used. - $form['settings']['title']['#default_value'] = ''; - $form['settings']['title']['#access'] = FALSE; + public function form($form, &$form_state) { + $form = parent::form($form, $form_state); + + // Set the default label to '' so the views internal title is used. + $form['label']['#default_value'] = ''; + $form['label']['#access'] = FALSE; return $form; }