Loading src/TwigRealContentTwigExtension.php +8 −0 Original line number Diff line number Diff line Loading @@ -80,6 +80,7 @@ class TwigRealContentTwigExtension extends AbstractExtension { * @throws \Drupal\twig_real_content\Exceptions\TwigRealContentException */ protected function ensureRendered($value) { // @see https://www.drupal.org/project/twig_real_content/issues/3293416 // The following would allow us to render the content given, // but that would lead to hidden performance implications, // so until now we decided not to do this. Loading @@ -93,9 +94,16 @@ class TwigRealContentTwigExtension extends AbstractExtension { // } // return \Drupal::service('renderer')->render($value); // } // If the value is NULL, return an empty string instead: if ($value === NULL) { return ''; } if (!is_string($value) && !$value instanceof MarkupInterface) { throw new TwigRealContentException('"Twig Has Content Filter" expects rendered strings as value, ' . gettype($value) . ' given. Did you forget to |render / capture the twig variable before?'); } return $value; } Loading Loading
src/TwigRealContentTwigExtension.php +8 −0 Original line number Diff line number Diff line Loading @@ -80,6 +80,7 @@ class TwigRealContentTwigExtension extends AbstractExtension { * @throws \Drupal\twig_real_content\Exceptions\TwigRealContentException */ protected function ensureRendered($value) { // @see https://www.drupal.org/project/twig_real_content/issues/3293416 // The following would allow us to render the content given, // but that would lead to hidden performance implications, // so until now we decided not to do this. Loading @@ -93,9 +94,16 @@ class TwigRealContentTwigExtension extends AbstractExtension { // } // return \Drupal::service('renderer')->render($value); // } // If the value is NULL, return an empty string instead: if ($value === NULL) { return ''; } if (!is_string($value) && !$value instanceof MarkupInterface) { throw new TwigRealContentException('"Twig Has Content Filter" expects rendered strings as value, ' . gettype($value) . ' given. Did you forget to |render / capture the twig variable before?'); } return $value; } Loading