diff --git a/CHANGELOG.md b/CHANGELOG.md index 23b681394f5..7ccb5253cdb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Unreleased - Fixed a bug where asset edit page URLs contained spaces if the asset filename contained spaces. ([#15236](https://github.com/craftcms/cms/issues/15236)) +- Fixed a bug where custom fields were getting included in rendered field layout forms, even if their `getInputHtml()` method returned an empty string. ## 4.13.7 - 2024-12-17 diff --git a/src/fieldlayoutelements/CustomField.php b/src/fieldlayoutelements/CustomField.php index 979d153a770..00c4ea1705e 100644 --- a/src/fieldlayoutelements/CustomField.php +++ b/src/fieldlayoutelements/CustomField.php @@ -284,7 +284,7 @@ protected function inputHtml(?ElementInterface $element = null, bool $static = f $this->_field->required = $required; $this->_field->describedBy = $describedBy; - return $html; + return $html !== '' ? $html : null; } /**