Skip to content
Snippets Groups Projects
Commit 7333d64f authored by Wolfgang Ziegler's avatar Wolfgang Ziegler
Browse files

Issue #3060570: Warning when rendering thunder image paragraphs: count():...

Issue #3060570: Warning when rendering thunder image paragraphs: count(): Parameter must be an array or an object that implements Countable.
parent f7fd261b
No related branches found
No related tags found
No related merge requests found
...@@ -194,9 +194,14 @@ class CustomElement implements CacheableDependencyInterface { ...@@ -194,9 +194,14 @@ class CustomElement implements CacheableDependencyInterface {
} }
// Do not add a default slot tag if this is the only content. // Do not add a default slot tag if this is the only content.
if (count($content) == 1 && isset($slots['default']) && count($slots['default']['attributes']) == 1 && !in_array($slots['default']['tag'], static::$noEndTags)) {
if (count($content) == 1 && isset($slots['default']) && !in_array($slots['default']['tag'], static::$noEndTags)) {
// Ensure no other attribute besides 'slot' has been added.
// If so, we can forward the slot content as content without slot tag.
if (array_keys($slots['default']['attributes']->storage()) == ['slot']) {
$content = $slots['default']['content']; $content = $slots['default']['content'];
} }
}
$this->setSlot($key, $content, $nestedElement->getPrefixedTag(), $nestedElement->getAttributes()); $this->setSlot($key, $content, $nestedElement->getPrefixedTag(), $nestedElement->getAttributes());
// Bubble up cache metadata. // Bubble up cache metadata.
$this->addCacheableDependency($nestedElement); $this->addCacheableDependency($nestedElement);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment