Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
5.1.3
=====

* (improvement) Add `useDescriptionAsAlt` settin in `AssetField`.


5.1.2
=====

Expand Down
5 changes: 5 additions & 0 deletions src/Field/Data/AssetData.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
) {}
}
6 changes: 6 additions & 0 deletions src/Field/Definition/AssetField.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -233,6 +238,7 @@ private function transformAssetData (mixed $data, ComponentContext $context) : ?
isExternal: $data["is_external_url"] ?? false,
width: $width,
height: $height,
useDescriptionAsAlt: $this->useDescriptionAsAlt,
);
}
}