Commit 530c4c45 authored by webchick's avatar webchick

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

parent 72711258
......@@ -137,4 +137,15 @@ protected function testDeleteBlockDisplay() {
$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.');
}
}
......@@ -60,12 +60,14 @@ public function blockAccess() {
}
/**
* 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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment