diff --git a/core/modules/views/src/Plugin/views/field/FieldHandlerInterface.php b/core/modules/views/src/Plugin/views/field/FieldHandlerInterface.php index 01769b5..b25e419 100644 --- a/core/modules/views/src/Plugin/views/field/FieldHandlerInterface.php +++ b/core/modules/views/src/Plugin/views/field/FieldHandlerInterface.php @@ -168,7 +168,9 @@ public function preRender(&$values); * The values retrieved from a single row of a view's query result. * * @return string|\Drupal\Component\Utility\SafeStringInterface - * The rendered output. + * The rendered output. If the output is safe it will be wrapped in a + * \Drupal\Core\Render\SafeString object. If it is empty or unsafe it will + * be a string. * */ public function render(ResultRow $values); @@ -203,7 +205,9 @@ public function postRender(ResultRow $row, $output); * The values retrieved from a single row of a view's query result. * * @return string|\Drupal\Component\Utility\SafeStringInterface - * The advanced rendered output. + * The advanced rendered output. If the output is safe it will be wrapped in + * a \Drupal\Core\Render\SafeString object. If it is empty or unsafe it will + * be a string. * */ public function advancedRender(ResultRow $values); @@ -237,29 +241,13 @@ public function isValueEmpty($value, $empty_zero, $no_skip_empty = TRUE); * - html: Make sure that the html is correct. * * @return string|\Drupal\Component\Utility\SafeStringInterface - * The rendered output. + * The rendered output. If the output is safe it will be wrapped in a + * \Drupal\Core\Render\SafeString object. If it is empty or unsafe it will + * be a string. */ public function renderText($alter); /** - * Trims the field down to the specified length. - * - * @param array $alter - * The alter array of options to use. - * - max_length: Maximum length of the string, the rest gets truncated. - * - word_boundary: Trim only on a word boundary. - * - ellipsis: Show an ellipsis (…) at the end of the trimmed string. - * - html: Make sure that the html is correct. - * - * @param string $value - * The string which should be trimmed. - * - * @return string - * The rendered trimmed string. - */ - public function renderTrimText($alter, $value); - - /** * Gets the 'render' tokens to use for advanced rendering. * * This runs through all of the fields and arguments that @@ -281,7 +269,9 @@ public function getRenderTokens($item); * Holds single row of a view's result set. * * @return string|\Drupal\Component\Utility\SafeStringInterface - * Returns rendered output of the given theme implementation. + * Returns rendered output of the given theme implementation. If the output + * is safe it will be wrapped in a \Drupal\Core\Render\SafeString object. If + * it is empty or unsafe it will be a string. */ function theme(ResultRow $values); diff --git a/core/modules/views/src/Plugin/views/field/FieldPluginBase.php b/core/modules/views/src/Plugin/views/field/FieldPluginBase.php index e92278f..973916b 100644 --- a/core/modules/views/src/Plugin/views/field/FieldPluginBase.php +++ b/core/modules/views/src/Plugin/views/field/FieldPluginBase.php @@ -1324,9 +1324,22 @@ protected function renderAltered($alter, $tokens) { } /** - * {@inheritdoc} + * Trims the field down to the specified length. + * + * @param array $alter + * The alter array of options to use. + * - max_length: Maximum length of the string, the rest gets truncated. + * - word_boundary: Trim only on a word boundary. + * - ellipsis: Show an ellipsis (…) at the end of the trimmed string. + * - html: Make sure that the html is correct. + * + * @param string $value + * The string which should be trimmed. + * + * @return string + * The rendered trimmed string. */ - public function renderTrimText($alter, $value) { + protected function renderTrimText($alter, $value) { if (!empty($alter['strip_tags'])) { // NOTE: It's possible that some external fields might override the // element type.