diff --git a/core/modules/views/src/Plugin/views/field/FieldPluginBase.php b/core/modules/views/src/Plugin/views/field/FieldPluginBase.php index 4e4bf7f..4764d03 100644 --- a/core/modules/views/src/Plugin/views/field/FieldPluginBase.php +++ b/core/modules/views/src/Plugin/views/field/FieldPluginBase.php @@ -326,7 +326,7 @@ public function elementClasses($row_index = NULL) { * {@inheritdoc} */ public function tokenizeValue($value, $row_index = NULL) { - if (strpos($value, '{{') !== FALSE) { + if (strpos($value, '{{') !== FALSE || strpos($value, '{%') !== FALSE) { $fake_item = array( 'alter_text' => TRUE, 'text' => $value, diff --git a/core/modules/views/src/Plugin/views/style/StylePluginBase.php b/core/modules/views/src/Plugin/views/style/StylePluginBase.php index 7f6cd16..d9d4dd7 100644 --- a/core/modules/views/src/Plugin/views/style/StylePluginBase.php +++ b/core/modules/views/src/Plugin/views/style/StylePluginBase.php @@ -228,7 +228,7 @@ public function getRowClass($row_index) { * Take a value and apply token replacement logic to it. */ public function tokenizeValue($value, $row_index) { - if (strpos($value, '{{') !== FALSE) { + if (strpos($value, '{{') !== FALSE || strpos($value, '{%') !== FALSE) { // Row tokens might be empty, for example for node row style. $tokens = isset($this->rowTokens[$row_index]) ? $this->rowTokens[$row_index] : array(); if (!empty($this->view->build_info['substitutions'])) { diff --git a/core/modules/views_ui/src/Tests/AreaUITest.php b/core/modules/views_ui/src/Tests/AreaUITest.php new file mode 100644 index 0000000..bf7486d --- /dev/null +++ b/core/modules/views_ui/src/Tests/AreaUITest.php @@ -0,0 +1,42 @@ +randomView([]); + $id = $default['id']; + $view = View::load($id); + + $type = $this->drupalCreateContentType()->id(); + $this->drupalCreateNode(array('type' => $type)); + + $this->drupalGet($view->urlInfo('edit-form')); + + // Configure the area header. + $this->drupalPostForm("admin/structure/views/nojs/add-handler/$id/page_1/header", ['name[views.area_text_custom]' => 1], 'Add and configure header'); + $this->drupalPostForm(NULL, ['options[empty]' => 'checked' , 'options[tokenize]' => 'checked', 'options[content]' => '{% if title %} This is the title: {{ title }} {% endif %}'], 'Apply'); + $this->drupalGet("/admin/structure/views/nojs/display/$id/page_1/row"); + $this->drupalPostForm(NULL, ['row[type]' => 'fields'], 'Apply'); + $this->drupalPostForm(NULL, [], 'Apply'); + $this->drupalPostForm(NULL, [], 'Save'); + + $this->drupalGet($id); + $this->assertText('This is the title'); + $this->assertNoText('{% endif %}'); + + } + +}