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

8.0.x
webchick 2013-12-03 13:40:42 -08:00
parent a83aaa166b
commit dff4856ede
2 changed files with 21 additions and 0 deletions

View File

@ -850,6 +850,8 @@ abstract class FieldPluginBase extends HandlerBase {
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) {

View File

@ -43,6 +43,25 @@ class FieldUITest extends UITestBase {
$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');
}
}