Commit dff4856e authored by webchick's avatar webchick
Browse files

Issue #2137837 by dawehner, andypost: Current field is not displayed in replacement patterns.

parent a83aaa16
......@@ -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) {
......
......@@ -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');
}
}
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