Skip to content
Snippets Groups Projects
Commit 6fa30efe authored by Pierre Dureau's avatar Pierre Dureau
Browse files

A lil' update

parent 551d7b53
No related branches found
No related tags found
No related merge requests found
......@@ -136,14 +136,15 @@ class LinksPropType extends PropTypePluginBase implements ContainerFactoryPlugin
// possible anymore because SDC will not validate it against the prop
// type schema.
$item["attributes"] = $item["attributes"]->toArray();
// Empty PHP arrays are converted in JSON arrays instead of JSON objects
// by json_encode(), so it is better to remove them.
if (empty($item['attributes'])) {
unset($item['attributes']);
return $item;
}
else {
foreach ($item["attributes"] as $attr => $value) {
if ($value instanceof Url) {
$item["attributes"][$attr] = $value->toString();
}
foreach ($item["attributes"] as $attr => $value) {
if ($value instanceof Url) {
$item["attributes"][$attr] = $value->toString();
}
}
}
......@@ -188,14 +189,15 @@ class LinksPropType extends PropTypePluginBase implements ContainerFactoryPlugin
// possible anymore because SDC will not validate it against the prop
// type schema.
$item["link_attributes"] = $options["attributes"];
// Empty PHP arrays are converted in JSON arrays instead of JSON objects
// by json_encode(), so it is better to remove them.
if (empty($item['link_attributes'])) {
unset($item['link_attributes']);
return $items;
}
else {
foreach ($item["link_attributes"] as $attr => $value) {
if ($value instanceof Url) {
$item["link_attributes"][$attr] = $value->toString();
}
foreach ($item["link_attributes"] as $attr => $value) {
if ($value instanceof Url) {
$item["link_attributes"][$attr] = $value->toString();
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment