Skip to content
Snippets Groups Projects
Commit 1294311d authored by Daniel Wehner's avatar Daniel Wehner Committed by Tim Plunkett
Browse files

Issue #1805540 by dawehner: Fixed All displays are marked as disabled all the time.

parent 36745dd0
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -145,6 +145,27 @@ public function testCloneDisplay() {
$this->assertLinkByHref($path_prefix . '/page_1', 0, 'Make sure after cloning the new display appears in the UI');
}
/**
* Tests disabling of a display.
*/
public function testDisableDisplay() {
$view = $this->randomView();
$path_prefix = 'admin/structure/views/view/' . $view['name'] .'/edit';
$this->drupalGet($path_prefix);
$this->assertFalse($this->xpath('//div[contains(@class, :class)]', array(':class' => 'views-display-disabled')), 'Make sure the disabled display css class does not appear after initial adding of a view.');
$this->assertFieldById('edit-displays-settings-settings-content-tab-content-details-top-actions-disable', '', 'Make sure the disable button is visible.');
$this->assertNoFieldById('edit-displays-settings-settings-content-tab-content-details-top-actions-enable', '', 'Make sure the enable button is not visible.');
$this->drupalPost(NULL, array(), 'disable Page');
$this->assertTrue($this->xpath('//div[contains(@class, :class)]', array(':class' => 'views-display-disabled')), 'Make sure the disabled display css class appears once the display is marked as such.');
$this->assertNoFieldById('edit-displays-settings-settings-content-tab-content-details-top-actions-disable', '', 'Make sure the disable button is not visible.');
$this->assertFieldById('edit-displays-settings-settings-content-tab-content-details-top-actions-enable', '', 'Make sure the enable button is visible.');
$this->drupalPost(NULL, array(), 'enable Page');
$this->assertFalse($this->xpath('//div[contains(@class, :class)]', array(':class' => 'views-display-disabled')), 'Make sure the disabled display css class does not appears once the display is enabled again.');
}
/**
* Tests views_ui_views_plugins_display_alter is altering plugin definitions.
*/
......
......@@ -1376,7 +1376,7 @@ public function buildEditForm($form, &$form_state, $display_id = NULL) {
// Add a text that the display is disabled.
if (!empty($this->displayHandlers[$display_id])) {
if ($this->displayHandlers[$display_id]->isEnabled()) {
if (!$this->displayHandlers[$display_id]->isEnabled()) {
$form['displays']['settings']['disabled']['#markup'] = t('This display is disabled.');
}
}
......@@ -1394,7 +1394,7 @@ public function buildEditForm($form, &$form_state, $display_id = NULL) {
$form['displays']['settings']['settings_content']['tab_content']['#attributes']['class'][] = 'views-display-deleted';
}
// Mark disabled displays as such.
if (empty($enabled)) {
if (!$this->displayHandlers[$display_id]->isEnabled()) {
$form['displays']['settings']['settings_content']['tab_content']['#attributes']['class'][] = 'views-display-disabled';
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment