Issue #1899910 by tim.plunkett: Fixed Regression: Views blocks should not have an editable label.

8.0.x
webchick 2013-02-01 18:18:51 -08:00
parent 72711258b1
commit 530c4c4541
2 changed files with 18 additions and 5 deletions

View File

@ -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.');
}
}

View File

@ -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;
}