diff --git a/CHANGELOG.md b/CHANGELOG.md index 944d968..69ce284 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +5.1.3 +===== + +* (improvement) Add `useDescriptionAsAlt` settin in `AssetField`. + + 5.1.2 ===== diff --git a/src/Field/Data/AssetData.php b/src/Field/Data/AssetData.php index de81d53..8bc620e 100644 --- a/src/Field/Data/AssetData.php +++ b/src/Field/Data/AssetData.php @@ -18,5 +18,10 @@ public function __construct ( public readonly bool $isExternal = false, public readonly ?int $width = null, public readonly ?int $height = null, + /** + * The description is the text that can be entered at the usage of the field. + * This flag controls whether the description should be used as alt text, if set. + */ + public readonly bool $useDescriptionAsAlt = true, ) {} } diff --git a/src/Field/Definition/AssetField.php b/src/Field/Definition/AssetField.php index bec0d79..71ffe08 100644 --- a/src/Field/Definition/AssetField.php +++ b/src/Field/Definition/AssetField.php @@ -34,6 +34,11 @@ public function __construct ( private readonly bool $allowMultiple = false, private readonly bool $allowExternalUrl = false, mixed $defaultValue = null, + /** + * The description is the text that can be entered at the usage of the field. + * This flag controls whether the description should be used as alt text, if set. + */ + private readonly bool $useDescriptionAsAlt = true, ) { parent::__construct($label, $defaultValue); @@ -233,6 +238,7 @@ private function transformAssetData (mixed $data, ComponentContext $context) : ? isExternal: $data["is_external_url"] ?? false, width: $width, height: $height, + useDescriptionAsAlt: $this->useDescriptionAsAlt, ); } }