Issue #1899910 by tim.plunkett: Fixed Regression: Views blocks should not have an editable label.
parent
72711258b1
commit
530c4c4541
|
@ -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.');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue