Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(contentType/field): asset field type add label field #1055

Merged
merged 4 commits into from
Oct 25, 2024
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
3 changes: 3 additions & 0 deletions EMS/core-bundle/src/Form/DataField/AssetFieldType.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ 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',
Expand All @@ -160,6 +162,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())),
];
Expand Down
3 changes: 3 additions & 0 deletions EMS/core-bundle/src/Form/Field/AssetType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
]);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,7 @@
{{- form_row(fileItem.sha1) -}}
{{- form_row(fileItem._image_resized_hash) -}}
{{- form_row(fileItem.mimetype) -}}
{{- form_row(fileItem._title) -}}
</div>
</div>
<div class="modal-footer">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
{% elseif dataField.rawData.files is defined and dataField.rawData.files is iterable %}
<ul class="nav nav-stacked">
{% for item in dataField.rawData.files %}
<li><a href="{{ ems_asset_path(item) }}" target="_blank">{{ item.filename }}</a></li>
<li><a href="{{ ems_asset_path(item) }}" target="_blank"{% if item._title|default %} title="{{ item._title }}"{% endif %}>{{ item.filename }}</a></li>
{% endfor %}
</ul>
{% endif %}
Expand Down
Loading