svn: /pear/peardoc/trunk/en/package/html/html-common2/ attributes.xml

[email protected] (Alexey Borzov) Sun, 08 Apr 2012 17:07:54 +0000
Newsgroups php.pear.doc
Message-ID <[email protected]>
--a707b35a50fdf9c8c2c95b1093d952e9e25b9c09
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit

avb                                      Sun, 08 Apr 2012 17:07:54 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=324962

Log:
Document changes in HTML_Common2 2.1.0

Changed paths:
    U   pear/peardoc/trunk/en/package/html/html-common2/attributes.xml

Modified: pear/peardoc/trunk/en/package/html/html-common2/attributes.xml
===================================================================
--- pear/peardoc/trunk/en/package/html/html-common2/attributes.xml	2012-04-08 16:47:53 UTC (rev 324961)
+++ pear/peardoc/trunk/en/package/html/html-common2/attributes.xml	2012-04-08 17:07:54 UTC (rev 324962)
@@ -37,6 +37,32 @@
    output, attribute names will always be lowercased and quotes will be used around attribute values
    when outputting the attribute string.</para>
  </refsection>
+ <refsection xml:id="package.html.html-common2.attributes.array">
+  <info>
+   <title>Using array notation</title>
+  </info>
+  <para>
+   Since release 2.1.0 <classname>HTML_Common2</classname> implements <link
+    xmlns:xlink="http://www.w3.org/1999/xlink"
+    xlink:href="&url.php.lookup;ArrayAccess"><interfacename>ArrayAccess</interfacename></link>
+   interface, allowing access to attributes using array notation:
+   <example>
+    <title>Accessing attributes as array keys</title>
+    <programlisting role="php"><![CDATA[
+if (!isset($html['id'])) {
+    // equivalent to $html->setAttribute('id', 'foo');
+    $html['id'] = 'foo';
+}
+// equivalent to $html->setAttribute('checked');
+$html[] = 'checked';
+// equivalent to $html->removeAttribute('checked');
+unset($html['checked']);
+     ]]></programlisting>
+   </example>
+
+  </para>
+
+ </refsection>
  <refsection xml:id="package.html.html-common2.attributes.class">
   <info>
    <title>Working with CSS Classes</title>

--a707b35a50fdf9c8c2c95b1093d952e9e25b9c09--