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

EZEE-3383: Additional data is now obtainable from html dataset #1661

Merged
merged 2 commits into from
Dec 9, 2020
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
{%- block ezplatform_fieldtype_ezimageasset_row -%}
{% set preview_block_name = 'ezimageasset_preview' %}
{% set widget_container_block_name = 'ezplatform_fieldtype_ezimageasset_widget_container' %}
{% set file_is_empty = not form.parent.vars.value.value.destinationContentId or not destination_content%}
{% set file_is_empty = not form.parent.vars.value.value.destinationContentId %}
{% if destination_content is defined %}
{% set file_is_empty = file_is_empty or not destination_content %}
{% endif %}
{% set max_file_size = form.vars.max_file_size %}
{% set language_code = form.parent.vars.languageCode %}
{% set attr = attr|merge({
Expand Down Expand Up @@ -37,13 +40,9 @@
<div class="ez-data-source__message--main">
{{ 'fieldtype.binary_base.drag_drop'|trans|desc('Drag your files to the browser window or select them') }}
</div>
<button class="btn ez-data-source__btn-add btn-secondary">{{ 'fieldtype.ezimageasset.upload.label'|trans|desc('Upload image') }}</button>
<button
class="btn ez-data-source__btn-select btn-secondary"
data-udw-config="{{ ez_udw_config('image_asset', {}) }}"
>
{{ 'fieldtype.ezimageasset.select.label'|trans|desc('Select from your Repository') }}
</button>

{{ block('ezimageasset_source_buttons') }}

{% if max_file_size is defined and max_file_size > 0 %}
<div class="ez-data-source__message--filesize">
{{ 'fieldtype.binary_base.max_file_size'|trans({'%size%': max_file_size|ez_file_size(2)})|desc('Max file size: %size%') }}
Expand All @@ -60,25 +59,39 @@
}}) -}}
{% endblock %}

{% block ezimageasset_source_buttons %}
<button class="btn ez-data-source__btn-add btn-secondary">
{{ 'fieldtype.ezimageasset.upload.label'|trans|desc('Upload image') }}
</button>
<button
class="btn ez-data-source__btn-select btn-secondary"
data-udw-config="{{ ez_udw_config('image_asset', {}) }}"
>
{{ 'fieldtype.ezimageasset.select.label'|trans|desc('Select from your Repository') }}
</button>
{% endblock %}

{% block ezimageasset_preview %}
{% form_theme form '@ezdesign/ui/field_type/edit/binary_base_fields.html.twig' %}

{% set destination_content_url = '//:0' %}
{% set destination_content_name = '' %}
{% set image_uri = '' %}
{% set destination_content_url = destination_content_url ?? '//:0' %}
{% set destination_content_name = destination_content_name ?? '' %}
{% set image_uri = image_uri ?? '' %}
{% set additional_data = additional_data ?? null %}

{% if destination_content %}
{% if destination_content is defined and destination_content is not null %}
{% set destination_content_name = ez_content_name(destination_content) %}
{% set destination_content_url = path('_ez_content_view', {
contentId: destination_content.id,
locationId: destination_content.contentInfo.mainLocationId,
}) %}

{% set image_uri = ez_field_value(destination_content, ez_content_field_identifier_image_asset()).uri %}
{% set additional_data = ez_field_value(destination_content, ez_content_field_identifier_image_asset()).additionalData %}
{% endif %}

<div class="ez-field-edit-preview">
<div class="ez-field-edit-preview__visual">
<div class="ez-field-edit-preview__visual" data-additional-data="{{ additional_data is not null ? additional_data|json_encode(): '{}' }}">
<div class="ez-field-edit-preview__media-wrapper">
<div class="ez-field-edit-preview__actions">
<button
Expand Down