Support boolean attributes

This commit is contained in:
Andrew Smith authored and Andrew Smith committed 2016-03-03 16:48:31 +10:00
1 parent 02c75dff24
commit 068dfb348d
2 files changed
+19 -4

No files matched your search

+6 -4
View File
@@ -420,11 +420,13 @@ class HtmlBuilder
*/
protected function attributeElement($key, $value)
{
// For numeric keys we will assume that the key and the value are the same
// as this will convert HTML attributes such as "required" to a correct
// form like required="required" instead of using incorrect numerics.
// For numeric keys we will assume that the value is a boolean attribute
// where the presence of the attribute represents a true value and the
// absence represents a false value.
// This will convert HTML attributes such as "required" to a correct
// form instead of using incorrect numerics.
if (is_numeric($key)) {
$key = $value;
return $value;
}
if (! is_null($value)) {