Mercurial > hg > isophonics-drupal-site
annotate core/lib/Drupal/Component/Render/MarkupInterface.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children |
rev | line source |
---|---|
Chris@0 | 1 <?php |
Chris@0 | 2 |
Chris@0 | 3 namespace Drupal\Component\Render; |
Chris@0 | 4 |
Chris@0 | 5 /** |
Chris@0 | 6 * Marks an object's __toString() method as returning markup. |
Chris@0 | 7 * |
Chris@0 | 8 * Objects that implement this interface will not be automatically XSS filtered |
Chris@0 | 9 * by the render system or automatically escaped by the theme engine. |
Chris@0 | 10 * |
Chris@0 | 11 * If there is any risk of the object's __toString() method returning |
Chris@0 | 12 * user-entered data that has not been filtered first, it must not be used. If |
Chris@0 | 13 * the object that implements this does not perform automatic escaping or |
Chris@0 | 14 * filtering itself, then it must be marked as "@internal". For example, Views |
Chris@0 | 15 * has the internal ViewsRenderPipelineMarkup object to provide a custom render |
Chris@0 | 16 * pipeline in order to render JSON and to fast render fields. By contrast, |
Chris@0 | 17 * FormattableMarkup and TranslatableMarkup always sanitize their output when |
Chris@0 | 18 * used correctly. |
Chris@0 | 19 * |
Chris@0 | 20 * If the object is going to be used directly in Twig templates it should |
Chris@0 | 21 * implement \Countable so it can be used in if statements. |
Chris@0 | 22 * |
Chris@0 | 23 * @see \Drupal\Component\Render\MarkupTrait |
Chris@0 | 24 * @see \Drupal\Core\Template\TwigExtension::escapeFilter() |
Chris@0 | 25 * @see \Drupal\Component\Render\FormattableMarkup |
Chris@0 | 26 * @see \Drupal\Core\StringTranslation\TranslatableMarkup |
Chris@0 | 27 * @see \Drupal\views\Render\ViewsRenderPipelineMarkup |
Chris@0 | 28 * @see twig_render_template() |
Chris@0 | 29 * @see sanitization |
Chris@0 | 30 * @see theme_render |
Chris@0 | 31 */ |
Chris@0 | 32 interface MarkupInterface extends \JsonSerializable { |
Chris@0 | 33 |
Chris@0 | 34 /** |
Chris@0 | 35 * Returns markup. |
Chris@0 | 36 * |
Chris@0 | 37 * @return string |
Chris@0 | 38 * The markup. |
Chris@0 | 39 */ |
Chris@0 | 40 public function __toString(); |
Chris@0 | 41 |
Chris@0 | 42 } |