{% extends '@OroUI/actions/update.html.twig' %}
{% set pageComponent = {
'module': 'oroui/js/app/components/view-component',
'options': {'view': 'oroemail/js/app/views/email-template-editor-view'},
'layout': 'separate'
} %}
{% form_theme form with [
'@OroForm/Form/fields.html.twig',
'@OroEmail/Form/fields.html.twig',
]%}
{% import '@OroEmail/macros.html.twig' as _emailMacros %}
{% if form.vars.value.id %}
{% oro_title_set({params : {"%name%": form.vars.value.name} }) %}
{% endif %}
{% set formAction = form.vars.value.id
? path('oro_email_emailtemplate_update', { id: form.vars.value.id })
: path('oro_email_emailtemplate_create')
%}
{% block navButtons %}
{% import '@OroUI/macros.html.twig' as UI %}
{% if is_granted('oro_email_emailtemplate_preview') %}
{{ UI.button({
'path' : path('oro_email_emailtemplate_preview', {'id': form.vars.value.id }),
'title' : 'oro.email.emailtemplate.action.preview'|trans,
'label' : 'oro.email.emailtemplate.action.preview'|trans,
'aCss': 'btn-success dialog-form-renderer no-hash',
'iCss': 'fa-share-square-o'
}) }}
{% endif %}
{% if form.vars.value.id and is_granted('oro_email_emailtemplate_clone') %}
{{ UI.button({
'path': path('oro_email_emailtemplate_clone', {'id': form.vars.value.id}),
'title': 'oro.email.emailtemplate.action.clone'|trans,
'label': 'oro.email.emailtemplate.action.clone'|trans,
'aCss': 'btn-success',
'iCss': 'fa-share-square-o'
}) }}
{{ UI.buttonSeparator() }}
{% endif %}
{% if form.vars.value.id and is_granted('DELETE', form.vars.value) %}
{{ UI.deleteButton({
'dataUrl': path('oro_api_delete_emailtemplate', {'id': form.vars.value.id}),
'dataRedirect': path('oro_email_emailtemplate_index'),
'aCss': 'no-hash remove-button',
'id': 'btn-remove-emailtemplate',
'dataId': form.vars.value.id,
'entity_label': 'oro.email.emailtemplate.entity_label'|trans
}) }}
{% endif %}
{{ UI.cancelButton(path('oro_email_emailtemplate_index')) }}
{% if form.vars.value.isEditable %}
{{ UI.buttonSeparator() }}
{% set html = UI.saveAndCloseButton({'route': 'oro_email_emailtemplate_index'}) %}
{% if is_granted('oro_email_emailtemplate_create') %}
{% set html = html ~ UI.saveAndNewButton({
'route': 'oro_email_emailtemplate_create'
}) %}
{% endif %}
{% if form.vars.value.id or is_granted('oro_email_emailtemplate_update') %}
{% set html = html ~ UI.saveAndStayButton({
'route': 'oro_email_emailtemplate_update',
'params': {'id': '$id'}
}) %}
{% endif %}
{{ UI.dropdownSaveButton({'html': html}) }}
{% endif %}
{% endblock navButtons %}
{% block pageHeader %}
{% if form.vars.value.id %}
{% set breadcrumbs = {
'entity': form.vars.value,
'indexPath': path('oro_email_emailtemplate_index'),
'indexLabel': 'oro.email.emailtemplate.entity_plural_label'|trans,
'entityTitle': 'oro.email.emailtemplate.edit_entity'|trans({'%name%': form.vars.value.name})
} %}
{{ parent() }}
{% else %}
{% set title = isClone
? 'oro.email.emailtemplate.clone_entity'|trans
: 'oro.ui.create_entity'|trans({'%entityName%': 'oro.email.emailtemplate.entity_label'|trans}) %}
{% include '@OroUI/page_title_block.html.twig' with { title: title } %}
{% endif %}
{% endblock pageHeader %}
{% block content_data %}
{% set id = 'emailtemplate-edit' %}
{% set dataBlocks = [
{
'title': 'oro.email.emailtemplate.sections.general'|trans,
'class': 'active',
'subblocks': [{
'title': '',
'data': [
form_row(form.name),
form_row(form.type, {'attr' : {'class': 'choice-template-type'}}),
form_row(form.entityName)
]
}]
},
{
'title': 'oro.email.emailtemplate.sections.template_data'|trans,
'subblocks': [
{
'title': '',
'data': [
form_widget(form.translations)
]
},
{
'title': '',
'data': [
_emailMacros.renderAvailableVariablesWidget(form.vars.value.entityName, form.entityName.vars.id)
]
}]
}
] %}
{% set dataBlocks = dataBlocks|merge(oro_form_additional_data(form, 'Additional'|trans)) %}
{% set data = {
'formErrors': form_errors(form)? form_errors(form) : null,
'dataBlocks': dataBlocks,
}
%}
{{ parent() }}
{% endblock content_data %}