diff --git a/core/lib/Drupal/Core/Render/RenderVariable.php b/core/lib/Drupal/Core/Render/RenderVariable.php
index f6c874a..0253166 100644
--- a/core/lib/Drupal/Core/Render/RenderVariable.php
+++ b/core/lib/Drupal/Core/Render/RenderVariable.php
@@ -1,27 +1,101 @@
' . $this->t("Note: In 'Entity Reference' displays, all fields will be displayed inline unless an explicit selection of inline fields is made here." );
+ $form['inline']['#description'] = RenderVariable::suffix($form['inline']['#description'], '
', $this->t("Note: In 'Entity Reference' displays, all fields will be displayed inline unless an explicit selection of inline fields is made here."));
}
/**
diff --git a/core/modules/views/src/Plugin/views/argument_default/ArgumentDefaultPluginBase.php b/core/modules/views/src/Plugin/views/argument_default/ArgumentDefaultPluginBase.php
index 72a7a67..8a9c0d8 100644
--- a/core/modules/views/src/Plugin/views/argument_default/ArgumentDefaultPluginBase.php
+++ b/core/modules/views/src/Plugin/views/argument_default/ArgumentDefaultPluginBase.php
@@ -8,6 +8,7 @@
namespace Drupal\views\Plugin\views\argument_default;
use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Render\RenderVariable;
use Drupal\views\ViewExecutable;
use Drupal\views\Plugin\views\argument\ArgumentPluginBase;
use Drupal\views\Plugin\views\PluginBase;
@@ -98,8 +99,7 @@ protected function checkAccess(&$form, $option_name) {
if (!$this->access()) {
$form[$option_name]['#disabled'] = TRUE;
$form[$option_name]['#value'] = $form[$this->option_name]['#default_value'];
- // @todo - hmmm what.
- $form[$option_name]['#description'] .= ' ' . $this->t('Note: you do not have permission to modify this. If you change the default filter type, this setting will be lost and you will NOT be able to get it back.') . '';
+ $form[$option_name]['#description'] = RenderVariable::suffix($form[$option_name]['#description'], ' ', $this->t('Note: you do not have permission to modify this. If you change the default filter type, this setting will be lost and you will NOT be able to get it back.'), '');
}
}
diff --git a/core/modules/views/src/Plugin/views/argument_validator/ArgumentValidatorPluginBase.php b/core/modules/views/src/Plugin/views/argument_validator/ArgumentValidatorPluginBase.php
index f83da27..017f992 100644
--- a/core/modules/views/src/Plugin/views/argument_validator/ArgumentValidatorPluginBase.php
+++ b/core/modules/views/src/Plugin/views/argument_validator/ArgumentValidatorPluginBase.php
@@ -8,6 +8,7 @@
namespace Drupal\views\Plugin\views\argument_validator;
use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Render\RenderVariable;
use Drupal\views\ViewExecutable;
use Drupal\views\Plugin\views\argument\ArgumentPluginBase;
use Drupal\views\Plugin\views\PluginBase;
@@ -94,7 +95,7 @@ protected function checkAccess(&$form, $option_name) {
$form[$option_name]['#disabled'] = TRUE;
$form[$option_name]['#value'] = $form[$this->option_name]['#default_value'];
// @todo - hmmm what.
- $form[$option_name]['#description'] .= ' ' . $this->t('Note: you do not have permission to modify this. If you change the default filter type, this setting will be lost and you will NOT be able to get it back.') . '';
+ $form[$option_name]['#description'] = RenderVariable::suffix($form[$option_name]['#description'], '', $this->t('Note: you do not have permission to modify this. If you change the default filter type, this setting will be lost and you will NOT be able to get it back.'), '');
}
}
diff --git a/core/tests/Drupal/Tests/Core/Render/RenderVariableTest.php b/core/tests/Drupal/Tests/Core/Render/RenderVariableTest.php
new file mode 100644
index 0000000..f58ffa6
--- /dev/null
+++ b/core/tests/Drupal/Tests/Core/Render/RenderVariableTest.php
@@ -0,0 +1,68 @@
+renderer->renderRoot($build);
+ $this->assertEquals($expected, (string) $render_output);
+ }
+
+ /**
+ * @return array
+ */
+ public function providerRenderVariablePrefix() {
+ $data = [];
+ $data[] = ['test<em>blah</em>', 'blah', ['test']];
+ $data[] = ['1 2 <em>blah</em>', 'blah', ['1', ' ', '2', ' ']];
+ $data[] = ['testblah', ['#markup' => 'blah'], ['test']];
+ $data[] = ['test blah', ['#markup' => 'blah'], ['test', ' ']];
+ return $data;
+ }
+
+ /**
+ * @covers ::prefix
+ *
+ * @dataProvider providerRenderVariableSuffix
+ */
+ public function testRenderVariableSuffix($expected, $variable, array $prefixes) {
+ $args = $prefixes;
+ array_unshift($args, $variable);
+ $build = call_user_func_array([RenderVariable::class, 'suffix'], $args);
+ $render_output = $this->renderer->renderRoot($build);
+ $this->assertEquals($expected, (string) $render_output);
+ }
+
+ /**
+ * @return array
+ */
+ public function providerRenderVariableSuffix() {
+ $data = [];
+ $data[] = ['<em>blah</em>test', 'blah', ['test']];
+ $data[] = ['<em>blah</em>1 2', 'blah', ['1', ' ', '2']];
+ $data[] = ['blahtest', ['#markup' => 'blah'], ['test']];
+ $data[] = ['blah test', ['#markup' => 'blah'], [' ', 'test']];
+ return $data;
+ }
+
+}