- Issue created by @codebymikey
- Merge request !126Issue #3453682: Smart date always shows a label in Layout Builder even with no value → (Open) created by codebymikey
- Status changed to Needs review
6 months ago 2:52pm 10 June 2024
As part of
#3119786: Default values are not displayed for image fields placed in Layout Builder →
, Layout Builder attempts to support fields which have a default value set. However the $field->getFieldDefinition()->getDefaultValue($entity)
call still returns values for the empty date, so we should probably return an empty array if no value is set.
Using Layout Builder, add a smart date field with no default to a page. The label will be shown even though there is no content to show.
Return an empty array for the default value if there is no value set.
Initially opted to patch Layout Builder core, so it checks if that the "main_property" exists in the returned array, but given that's a big assumption on core regarding the field type's default value implementation, it made more sense to address it within the field plugin itself.
Provide issue fork/patch.
N/A
N/A
Needs review
4.1
Code