Upgraded drupal core with security updates
[yaffs-website] / web / core / lib / Drupal / Core / Template / AttributeString.php
1 <?php
2
3 namespace Drupal\Core\Template;
4
5 use Drupal\Component\Utility\Html;
6
7 /**
8  * A class that represents most standard HTML attributes.
9  *
10  * To use with the Attribute class, set the key to be the attribute name
11  * and the value the attribute value.
12  * @code
13  *  $attributes = new Attribute(array());
14  *  $attributes['id'] = 'socks';
15  *  $attributes['style'] = 'background-color:white';
16  *  echo '<cat ' . $attributes . '>';
17  *  // Produces: <cat id="socks" style="background-color:white">.
18  * @endcode
19  *
20  * @see \Drupal\Core\Template\Attribute
21  */
22 class AttributeString extends AttributeValueBase {
23
24   /**
25    * Implements the magic __toString() method.
26    */
27   public function __toString() {
28     return Html::escape($this->value);
29   }
30
31 }