Skip to content
Snippets Groups Projects
Commit bd1b3a47 authored by catch's avatar catch
Browse files

Issue #2780583 by Lendude, joachim, Nitebreed: Views field token replacement...

Issue #2780583 by Lendude, joachim, Nitebreed: Views field token replacement patterns aren't showing in area handlers admin form
parent 148fb3fb
Branches
Tags
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
......@@ -79,7 +79,7 @@ public function tokenForm(&$form, FormStateInterface $form_state) {
foreach ($options[$type] as $key => $value) {
$items[] = $key . ' == ' . $value;
}
$form['tokens']['tokens'] = array(
$form['tokens'][$type]['tokens'] = array(
'#theme' => 'item_list',
'#items' => $items,
);
......
<?php
namespace Drupal\views_ui\Tests;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\views\Entity\View;
/**
* Tests the token display for the TokenizeAreaPluginBase UI.
*
* @see \Drupal\views\Plugin\views\area\Entity
* @group views_ui
*/
class TokenizeAreaUITest extends UITestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['entity_test'];
/**
* Test that the right tokens are shown as available for replacement.
*/
public function testTokenUI() {
$entity_test = EntityTest::create(['bundle' => 'entity_test']);
$entity_test->save();
$default = $this->randomView([]);
$id = $default['id'];
$view = View::load($id);
$this->drupalGet($view->toUrl('edit-form'));
// Add a global NULL argument to the view for testing argument tokens.
$this->drupalPostForm("admin/structure/views/nojs/add-handler/$id/page_1/argument", ['name[views.null]' => 1], 'Add and configure contextual filters');
$this->drupalPostForm(NULL, [], 'Apply');
$this->drupalPostForm("admin/structure/views/nojs/add-handler/$id/page_1/header", ['name[views.area]' => 'views.area'], 'Add and configure header');
// Test that field tokens are shown.
$this->assertText('{{ title }} == Content: Title');
// Test that argument tokens are shown.
$this->assertText('{{ arguments.null }} == Global: Null title');
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment