Commit 1f504dd5 authored by catch's avatar catch

Issue #2610236 by cilefen, aerozeppelin: Views - "No Results Behavior" for...

Issue #2610236 by cilefen, aerozeppelin: Views - "No Results Behavior" for individual fields escapes HTML
parent 5bff82c8
......@@ -1248,10 +1248,7 @@ public function renderText($alter) {
if ($alter['phase'] == static::RENDER_TEXT_PHASE_EMPTY && $no_rewrite_for_empty) {
// If we got here then $alter contains the value of "No results text"
// and so there is nothing left to do.
if ($value_is_safe) {
$value = ViewsRenderPipelineMarkup::create($value);
}
return $value;
return ViewsRenderPipelineMarkup::create($value);
}
if (!empty($alter['strip_tags'])) {
......
......@@ -258,6 +258,23 @@ public function testRenderTrimmedWithMoreLink() {
$this->assertEquals($expected_result, $result);
}
/**
* Tests the "No results text" rendering.
*
* @covers ::renderText
*/
public function testRenderNoResult() {
$this->setupDisplayWithEmptyArgumentsAndFields();
$field = $this->setupTestField(['empty' => 'This <strong>should work</strong>.']);
$field->field_alias = 'key';
$row = new ResultRow(['key' => '']);
$expected_result = 'This <strong>should work</strong>.';
$result = $field->advancedRender($row);
$this->assertEquals($expected_result, $result);
$this->assertInstanceOf('\Drupal\views\Render\ViewsRenderPipelineMarkup', $result);
}
/**
* Test rendering of a link with a path and options.
*
......
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