- Fixed a bug caused by JsonSerialization and old code accessing attributes.

- Fixed Checkbox and Radio checked using a 4th option parameter
This commit is contained in:
Dave Mc Nicoll committed 2020-04-09 14:35:24 -04:00
1 parent 23e8eb71f6
commit 48536ab11d
4 files changed
+51 -22

No files matched your search

+6 -6
View File
@@ -178,7 +178,7 @@ class UiElement implements \ArrayAccess, \Iterator, \JsonSerializable {
}
else if ( !is_numeric($key) ) {
# will output something like <tag $key=$value></tag>
$attributesList[] = "$key=\"$value\"";
$attributesList[] = strpos($value, '"') !== false ? "$key='$value'" : "$key=\"$value\"";
}
else {
# will output something like <tag $value></tag>
@@ -186,7 +186,7 @@ class UiElement implements \ArrayAccess, \Iterator, \JsonSerializable {
}
}
$content = "";
foreach ( $this->childs as $item ) {
@@ -198,14 +198,14 @@ class UiElement implements \ArrayAccess, \Iterator, \JsonSerializable {
}
}
if ( in_array('no-tag', $this->options) ) {
if ( in_array('no-tag', $this->options, true) ) {
return $this->content . $content;
}
else {
$compiledAttributes = (count($attributesList) && ! in_array('no-attr', $this->options) ? " " . implode(" ", $attributesList) : "");
$compiledAttributes = (count($attributesList) && ! in_array('no-attr', $this->options, true) ? " " . implode(" ", $attributesList) : "");
# Force the node to contain a certain opening tag (php is a good example)
if ( in_array('force-tag-open', $this->options) ) {
if ( in_array('force-tag-open', $this->options, true) ) {
$opentag = $this->options['force-tag-open'] . $compiledAttributes;
}
else {
@@ -217,7 +217,7 @@ class UiElement implements \ArrayAccess, \Iterator, \JsonSerializable {
$closetag = "";
}
}
elseif ( in_array('force-tag-close', $this->options) ) {
elseif ( in_array('force-tag-close', $this->options, true) ) {
$closetag = $this->options['force-tag-close'];
}
else {