diff --git a/contribution-license-agreement.txt b/contribution-license-agreement.txt new file mode 100644 index 00000000..2fcef973 --- /dev/null +++ b/contribution-license-agreement.txt @@ -0,0 +1 @@ +I hereby agree to Spryker's Contribution License Agreement in https://github.com/spryker/product-management/blob/d9ca3d5624ffcc3862aac94ceb3450fae8eb2421/CONTRIBUTING.md diff --git a/data/translation/Zed/de_DE.csv b/data/translation/Zed/de_DE.csv index fa0bf872..12997359 100644 --- a/data/translation/Zed/de_DE.csv +++ b/data/translation/Zed/de_DE.csv @@ -106,3 +106,5 @@ Price,Preis select,auswählen "Product name",Produktname Types,Typen +Alt text small,Alt-Text klein +Alt text large,Alt-Text groß diff --git a/data/translation/Zed/en_US.csv b/data/translation/Zed/en_US.csv index 42d12d68..91c9bd81 100644 --- a/data/translation/Zed/en_US.csv +++ b/data/translation/Zed/en_US.csv @@ -106,3 +106,5 @@ Price,Price select,select "Product name","Product name" Types,Types +Alt text small,Alt text small +Alt text large,Alt text large diff --git a/src/Spryker/Zed/ProductManagement/Communication/Form/Product/ImageCollectionForm.php b/src/Spryker/Zed/ProductManagement/Communication/Form/Product/ImageCollectionForm.php index 44e38fa1..c2d4c3d7 100644 --- a/src/Spryker/Zed/ProductManagement/Communication/Form/Product/ImageCollectionForm.php +++ b/src/Spryker/Zed/ProductManagement/Communication/Form/Product/ImageCollectionForm.php @@ -63,6 +63,16 @@ class ImageCollectionForm extends AbstractSubForm */ public const FIELD_FK_IMAGE_SET_ID = 'fk_image_set_id'; + /** + * @var string + */ + public const FIELD_ALT_TEXT_SMALL = 'alt_text_small'; + + /** + * @var string + */ + public const FIELD_ALT_TEXT_LARGE = 'alt_text_large'; + /** * @var string */ @@ -120,7 +130,9 @@ public function buildForm(FormBuilderInterface $builder, array $options): void ->addImagePreviewField($builder, $options) ->addImageSmallField($builder, $options) ->addImageBigField($builder, $options) - ->addSortOrderField($builder, $options); + ->addSortOrderField($builder, $options) + ->addAltTextSmallField($builder, $options) + ->addAltTextLargeField($builder, $options); } /** @@ -279,4 +291,50 @@ protected function addSortOrderField(FormBuilderInterface $builder, array $optio return $this; } + + /** + * @param \Symfony\Component\Form\FormBuilderInterface $builder + * @param array $options + * + * @return $this + */ + protected function addAltTextSmallField(FormBuilderInterface $builder, array $options) + { + $builder->add(static::FIELD_ALT_TEXT_SMALL, TextType::class, [ + 'required' => false, + 'label' => 'Alt text small', + 'constraints' => [ + new Length([ + 'min' => 0, + 'max' => 255, + ]), + ], + 'sanitize_xss' => true, + ]); + + return $this; + } + + /** + * @param \Symfony\Component\Form\FormBuilderInterface $builder + * @param array $options + * + * @return $this + */ + protected function addAltTextLargeField(FormBuilderInterface $builder, array $options) + { + $builder->add(static::FIELD_ALT_TEXT_LARGE, TextType::class, [ + 'required' => false, + 'label' => 'Alt text large', + 'constraints' => [ + new Length([ + 'min' => 0, + 'max' => 255, + ]), + ], + 'sanitize_xss' => true, + ]); + + return $this; + } } diff --git a/src/Spryker/Zed/ProductManagement/Presentation/_partials/product-image-collection-theme.twig b/src/Spryker/Zed/ProductManagement/Presentation/_partials/product-image-collection-theme.twig index 09bac65e..184637a8 100644 --- a/src/Spryker/Zed/ProductManagement/Presentation/_partials/product-image-collection-theme.twig +++ b/src/Spryker/Zed/ProductManagement/Presentation/_partials/product-image-collection-theme.twig @@ -13,6 +13,9 @@
{{ form_row(form.external_url_small) }}
+
+ {{ form_row(form.alt_text_small) }} +
@@ -27,6 +30,9 @@
{{ form_row(form.external_url_large) }}
+
+ {{ form_row(form.alt_text_large) }} +
{% for child in form %}