{% extends '@OroUI/actions/update.html.twig' %}
{% import '@OroChannel/macros.html.twig' as channelMacro %}
{% set entity = form.vars.value %}
{% set formAction = entity.id ? path('oro_channel_update', { id: entity.id }) : path('oro_channel_create') %}
{% if entity.id %}
{% oro_title_set({params : {"%channel.name%": entity.name } }) %}
{% endif %}
{% block pageHeader %}
{% if entity.id %}
{% set breadcrumbs = {
'entity': entity,
'indexPath': path('oro_channel_index'),
'indexLabel': 'oro.channel.entity_plural_label'|trans,
'entityTitle': entity.name|default('N/A'|trans)
} %}
{{ parent() }}
{% else %}
{% set title = 'oro.ui.create_entity'|trans({'%entityName%': 'oro.channel.entity_label'|trans}) %}
{% include '@OroUI/page_title_block.html.twig' with { title: title }%}
{% endif %}
{% endblock pageHeader %}
{% block navButtons %}
{% import '@OroUI/macros.html.twig' as UI %}
{% if entity.id and is_granted('DELETE', entity) %}
{{ UI.deleteButton({
'dataUrl': path('oro_api_delete_channel', {'id': entity.id}),
'dataRedirect': path('oro_channel_index'),
'aCss': 'no-hash remove-button',
'id': 'btn-remove-channel',
'dataId': entity.id,
'entity_label': 'oro.channel.entity_label'|trans,
}) }}
{{ UI.buttonSeparator() }}
{% endif %}
{{ UI.cancelButton(path('oro_channel_index')) }}
{% set html = UI.saveAndCloseButton({
'route': 'oro_channel_view',
'params': {'id': '$id', '_enableContentProviders': 'mainMenu'}
}) %}
{% if is_granted('oro_channel_create') %}
{% set html = html ~ UI.saveAndNewButton({
'route': 'oro_channel_create'
}) %}
{% endif %}
{% if form.vars.value.id or is_granted('oro_channel_update') %}
{% set html = html ~ UI.saveAndStayButton({
'route': 'oro_channel_update',
'params': {'id': '$id', '_enableContentProviders': 'mainMenu'}
}) %}
{% endif %}
{{ UI.dropdownSaveButton({'html': html}) }}
{% endblock %}
{% block breadcrumbs %}
{{ parent() }}
{% endblock breadcrumbs %}
{% block content_data %}
{% set id = 'channel-update' %}
{% set dataBlocks = [
{
'title': 'General'|trans,
'subblocks': [{
'title': '',
'data': [
form_row(form.name),
form_row(form.channelType),
form.dataSource is defined ? form_row(form.dataSource) : '',
]
}]
}
] %}
{% if form.vars.value.entities|length > 0 %}
{% set dataBlocks = dataBlocks|merge([{
'title': 'Entities'|trans,
'subblocks': [{
'title': '',
'data': [ form_row(form.entities) ]
}]
}]) %}
{% endif %}
{% set additional %}{% placeholder oro_channel_additional_block with {entity: entity, form: form} %}{% endset %}
{% if additional|trim %}
{% set dataBlocks = dataBlocks|merge([{
'title': 'Additional'|trans,
'subblocks': [{
'title': '',
'data': [ additional ]
}]
}]) %}
{% endif %}
{% set data = {
'formErrors': form_errors(form)? form_errors(form) : null,
'dataBlocks': dataBlocks,
} %}
{{ parent() }}
{{ channelMacro.initializeChannelForm(form, oro_channel_entities_metadata(), entity.customerIdentity) }}
{% endblock %}