3 namespace Drupal\Component\Render;
6 * Marks an object's __toString() method as returning markup.
8 * Objects that implement this interface will not be automatically XSS filtered
9 * by the render system or automatically escaped by the theme engine.
11 * If there is any risk of the object's __toString() method returning
12 * user-entered data that has not been filtered first, it must not be used. If
13 * the object that implements this does not perform automatic escaping or
14 * filtering itself, then it must be marked as "@internal". For example, Views
15 * has the internal ViewsRenderPipelineMarkup object to provide a custom render
16 * pipeline in order to render JSON and to fast render fields. By contrast,
17 * FormattableMarkup and TranslatableMarkup always sanitize their output when
20 * If the object is going to be used directly in Twig templates it should
21 * implement \Countable so it can be used in if statements.
23 * @see \Drupal\Component\Render\MarkupTrait
24 * @see \Drupal\Core\Template\TwigExtension::escapeFilter()
25 * @see \Drupal\Component\Render\FormattableMarkup
26 * @see \Drupal\Core\StringTranslation\TranslatableMarkup
27 * @see \Drupal\views\Render\ViewsRenderPipelineMarkup
28 * @see twig_render_template()
32 interface MarkupInterface extends \JsonSerializable {
40 public function __toString();