From 3de01bd6ac64c3dfefa5375f8226f3ee6fd9ab8d Mon Sep 17 00:00:00 2001 From: Mathieu De Keyzer Date: Fri, 25 Oct 2024 07:56:43 +0200 Subject: [PATCH 1/3] feat: add _title in revision form --- EMS/core-bundle/src/Form/DataField/AssetFieldType.php | 2 ++ EMS/core-bundle/src/Form/Field/AssetType.php | 3 +++ EMS/core-bundle/src/Resources/views/form/fields.html.twig | 1 + 3 files changed, 6 insertions(+) diff --git a/EMS/core-bundle/src/Form/DataField/AssetFieldType.php b/EMS/core-bundle/src/Form/DataField/AssetFieldType.php index 1abfbccc8..815f9a26c 100644 --- a/EMS/core-bundle/src/Form/DataField/AssetFieldType.php +++ b/EMS/core-bundle/src/Form/DataField/AssetFieldType.php @@ -147,6 +147,7 @@ public function buildView(FormView $view, FormInterface $form, array $options): */ public function generateMapping(FieldType $current): array { + $mapping = parent::generateMapping($current); return [ $current->getName() => \array_merge([ 'type' => 'nested', @@ -160,6 +161,7 @@ public function generateMapping(FieldType $current): array EmsFields::CONTENT_FILE_SIZE_FIELD => $this->elasticsearchService->getLongMapping(), EmsFields::CONTENT_FILE_SIZE_FIELD_ => $this->elasticsearchService->getLongMapping(), EmsFields::CONTENT_IMAGE_RESIZED_HASH_FIELD => $this->elasticsearchService->getKeywordMapping(), + EmsFields::CONTENT_FILE_TITLE => $mapping[$current->getName()], ], ], \array_filter($current->getMappingOptions())), ]; diff --git a/EMS/core-bundle/src/Form/Field/AssetType.php b/EMS/core-bundle/src/Form/Field/AssetType.php index 0187da56e..15903a4dc 100644 --- a/EMS/core-bundle/src/Form/Field/AssetType.php +++ b/EMS/core-bundle/src/Form/Field/AssetType.php @@ -51,6 +51,9 @@ public function buildForm(FormBuilderInterface $builder, array $options): void 'class' => 'name', ], 'required' => $options['required'], + ]) + ->add(EmsFields::CONTENT_FILE_TITLE, TextType::class, [ + 'required' => $options['required'], ]); } } diff --git a/EMS/core-bundle/src/Resources/views/form/fields.html.twig b/EMS/core-bundle/src/Resources/views/form/fields.html.twig index de9e6c127..3a27cabf9 100644 --- a/EMS/core-bundle/src/Resources/views/form/fields.html.twig +++ b/EMS/core-bundle/src/Resources/views/form/fields.html.twig @@ -983,6 +983,7 @@ {{- form_row(fileItem.sha1) -}} {{- form_row(fileItem._image_resized_hash) -}} {{- form_row(fileItem.mimetype) -}} + {{- form_row(fileItem._title) -}}