diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Tests/FieldUITest.php b/core/modules/views_ui/lib/Drupal/views_ui/Tests/FieldUITest.php new file mode 100644 index 0000000..e5b6d74 --- /dev/null +++ b/core/modules/views_ui/lib/Drupal/views_ui/Tests/FieldUITest.php @@ -0,0 +1,48 @@ + 'Field: UI', + 'description' => 'Tests the UI of field handlers.', + 'group' => 'Views UI', + ); + } + + /** + * Tests the UI of field handlers. + */ + public function testFieldUI() { + // Ensure the field is not marked as hidden on the first run. + $this->drupalGet('admin/structure/views/view/test_view/edit'); + $this->assertText('Views test: Name (Name)'); + $this->assertNoText('Views test: Name (Name) [' . t('hidden') . ']'); + + // Hides the field and check whether the hidden label is appended. + $edit_handler_url = 'admin/structure/views/nojs/config-item/test_view/default/field/name'; + $this->drupalPost($edit_handler_url, array('options[exclude]' => TRUE), t('Apply')); + + $this->assertText('Views test: Name (Name) [' . t('hidden') . ']'); + } + +} diff --git a/core/modules/views_ui/lib/Drupal/views_ui/ViewEditFormController.php b/core/modules/views_ui/lib/Drupal/views_ui/ViewEditFormController.php index 9f3e0b6..100a1ef 100644 --- a/core/modules/views_ui/lib/Drupal/views_ui/ViewEditFormController.php +++ b/core/modules/views_ui/lib/Drupal/views_ui/ViewEditFormController.php @@ -988,6 +988,8 @@ public function getFormBucket(ViewUI $view, $type, $display) { $link_attributes = array('class' => array('views-ajax-link')); if (!empty($field['exclude'])) { $link_attributes['class'][] = 'views-field-excluded'; + // Add a [hidden] marker, if the field is excluded. + $link_text .= ' [' . t('hidden') . ']'; } $build['fields'][$id]['#link'] = l($link_text, "admin/structure/views/nojs/config-item/{$view->id()}/{$display['id']}/$type/$id", array('attributes' => $link_attributes, 'html' => TRUE)); $build['fields'][$id]['#class'][] = drupal_clean_css_identifier($display['id']. '-' . $type . '-' . $id);