diff --git a/src/DonationForms/Properties/FormSettings.php b/src/DonationForms/Properties/FormSettings.php index cd590c0e83..ce56af88c3 100644 --- a/src/DonationForms/Properties/FormSettings.php +++ b/src/DonationForms/Properties/FormSettings.php @@ -188,6 +188,12 @@ class FormSettings implements Arrayable, Jsonable */ public $designSettingsImageUrl; + /** + * @unreleased + * @var string + */ + public $designSettingsImageAlt; + /** * @since 3.4.0 * @var string @@ -321,6 +327,7 @@ public static function fromArray(array $array): self ) ? $array['pdfSettings'] : []; $self->designSettingsImageUrl = $array['designSettingsImageUrl'] ?? ''; + $self->designSettingsImageAlt = $array['designSettingsImageAlt'] ?? $self->formTitle; $self->designSettingsImageStyle = ! empty($array['designSettingsImageStyle']) ? new DesignSettingsImageStyle( $array['designSettingsImageStyle'] ) : DesignSettingsImageStyle::BACKGROUND(); diff --git a/src/DonationForms/resources/app/form/Header.tsx b/src/DonationForms/resources/app/form/Header.tsx index 0b033001c3..f5151379e4 100644 --- a/src/DonationForms/resources/app/form/Header.tsx +++ b/src/DonationForms/resources/app/form/Header.tsx @@ -32,7 +32,7 @@ export default function Header({form}: {form: DonationForm}) { form.settings?.designSettingsImageUrl && ( diff --git a/src/FormBuilder/resources/js/form-builder/src/components/settings/MediaLibrary/index.tsx b/src/FormBuilder/resources/js/form-builder/src/components/settings/MediaLibrary/index.tsx index 153fda2bb7..85948eae28 100644 --- a/src/FormBuilder/resources/js/form-builder/src/components/settings/MediaLibrary/index.tsx +++ b/src/FormBuilder/resources/js/form-builder/src/components/settings/MediaLibrary/index.tsx @@ -12,7 +12,7 @@ import './styles.scss'; type MediaLibrary = { id: string; value: string; - onChange: (url: string) => void; + onChange: (url: string, alt: string) => void; reset: () => void; label: string; help?: string; @@ -44,7 +44,7 @@ export default function MediaLibrary({id, value, onChange, label, help, actionLa // Get media attachment details from the frame state var attachment = frame.state().get('selection').first().toJSON(); - onChange(attachment.url); + onChange(attachment.url, attachment.alt); }); // Finally, open the modal on click diff --git a/src/FormBuilder/resources/js/form-builder/src/settings/design/general-controls/header/index.tsx b/src/FormBuilder/resources/js/form-builder/src/settings/design/general-controls/header/index.tsx index 2fce0645f7..d327a0a0dc 100644 --- a/src/FormBuilder/resources/js/form-builder/src/settings/design/general-controls/header/index.tsx +++ b/src/FormBuilder/resources/js/form-builder/src/settings/design/general-controls/header/index.tsx @@ -123,16 +123,18 @@ export default function Header({dispatch, publishSettings}) { label={__('Image', 'give')} actionLabel={__('Upload Image', 'give')} value={designSettingsImageUrl} - onChange={(designSettingsImageUrl) => { + onChange={(designSettingsImageUrl, designSettingsImageAlt) => { dispatch( setFormSettings({ designSettingsImageUrl, + designSettingsImageAlt, designSettingsImageStyle, }) ); publishSettings({ designSettingsImageUrl, + designSettingsImageAlt, designSettingsImageStyle, }); }} diff --git a/src/FormBuilder/resources/js/form-builder/src/types/formSettings.ts b/src/FormBuilder/resources/js/form-builder/src/types/formSettings.ts index bf2c5375bf..2c9a095f8d 100644 --- a/src/FormBuilder/resources/js/form-builder/src/types/formSettings.ts +++ b/src/FormBuilder/resources/js/form-builder/src/types/formSettings.ts @@ -45,6 +45,7 @@ export type FormSettings = { pdfSettings: object; designSettingsImageUrl: string; designSettingsImageStyle: string; + designSettingsImageAlt: string; designSettingsLogoUrl: string; designSettingsLogoPosition: string; designSettingsSectionStyle: string;