37977a6864d76ef87324c6b3a3b318243d3eb3ad
[yaffs-website] / MarkupInterface.php
1 <?php
2
3 namespace Drupal\Component\Render;
4
5 /**
6  * Marks an object's __toString() method as returning markup.
7  *
8  * Objects that implement this interface will not be automatically XSS filtered
9  * by the render system or automatically escaped by the theme engine.
10  *
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
18  * used correctly.
19  *
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.
22  *
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()
29  * @see sanitization
30  * @see theme_render
31  */
32 interface MarkupInterface extends \JsonSerializable {
33
34   /**
35    * Returns markup.
36    *
37    * @return string
38    *   The markup.
39    */
40   public function __toString();
41
42 }