- if (($input_only && !$target->hasProperty('input'))
- // Ignore if the actual element has no #description set.
- || !$this->hasProperty('description')
+
+ // If the description is a render array, it must first be pre-rendered so
+ // it can be later passed to Unicode::isSimple() if needed.
+ $description = $this->hasProperty('description') ? $this->getProperty('description') : FALSE;
+ if (static::isRenderArray($description)) {
+ $description = static::createStandalone($description)->renderPlain();
+ }
+
+ if (
+ // Ignore if element has no #description.
+ !$description
+
+ // Ignore if description is not a simple string or MarkupInterface.
+ || (!is_string($description) && !($description instanceof MarkupInterface))
+
+ // Ignore if element is not an input.
+ || ($input_only && !$target->hasProperty('input'))