diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/field/FieldPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/field/FieldPluginBase.php index fad42d604f2839215ab10fb12a8dd4747936bc62..db4a5d8e2950e01becd4852499febc40b74a4f1e 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/field/FieldPluginBase.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/field/FieldPluginBase.php @@ -850,6 +850,8 @@ public function buildOptionsForm(&$form, &$form_state) { foreach ($previous as $id => $label) { $options[t('Fields')]["[$id]"] = $label; } + // Add the field to the list of options. + $options[t('Fields')]["[{$this->options['id']}]"] = $this->label(); $count = 0; // This lets us prepare the key as we want it printed. foreach ($this->view->display_handler->getHandlers('argument') as $arg => $handler) { 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 index 725ccd97177a35a59b3c59702c09fc5ae057aae6..160e99cbeeb5e846b687df7cd27c99669b13d156 100644 --- a/core/modules/views_ui/lib/Drupal/views_ui/Tests/FieldUITest.php +++ b/core/modules/views_ui/lib/Drupal/views_ui/Tests/FieldUITest.php @@ -43,6 +43,25 @@ public function testFieldUI() { $this->drupalPostForm($edit_handler_url, array('options[exclude]' => TRUE), t('Apply')); $this->assertText('Views test: Name (Name) [' . t('hidden') . ']'); + + // Ensure that the expected tokens appear in the UI. + $edit_handler_url = 'admin/structure/views/nojs/config-item/test_view/default/field/age'; + $this->drupalGet($edit_handler_url); + $result = $this->xpath('//details[@id="edit-options-alter-help"]/div[@class="details-wrapper"]/div[@class="item-list"]/fields/li'); + $this->assertEqual((string) $result[0], '[age] == Age'); + + $edit_handler_url = 'admin/structure/views/nojs/config-item/test_view/default/field/id'; + $this->drupalGet($edit_handler_url); + $result = $this->xpath('//details[@id="edit-options-alter-help"]/div[@class="details-wrapper"]/div[@class="item-list"]/fields/li'); + $this->assertEqual((string) $result[0], '[age] == Age'); + $this->assertEqual((string) $result[1], '[id] == ID'); + + $edit_handler_url = 'admin/structure/views/nojs/config-item/test_view/default/field/name'; + $this->drupalGet($edit_handler_url); + $result = $this->xpath('//details[@id="edit-options-alter-help"]/div[@class="details-wrapper"]/div[@class="item-list"]/fields/li'); + $this->assertEqual((string) $result[0], '[age] == Age'); + $this->assertEqual((string) $result[1], '[id] == ID'); + $this->assertEqual((string) $result[2], '[name] == Name'); } }