DigitalState/Platform-Notification-Bundle

View on GitHub
Resources/views/Notification/edit.html.twig

Summary

Maintainability
Test Coverage
{% extends 'OroUIBundle:actions:update.html.twig' %}

{% form_theme form with 'OroFormBundle:Form:fields.html.twig' %}

{% if entity.id %}
    {% set formAction = path('ds_notification_notification_edit', { id: entity.id }) %}
{% else %}
    {% set formAction = path('ds_notification_notification_create', { alias: alias }) %}
{% endif %}

{% block navButtons %}
    {% if entity.id and resource_granted('ds.notification.notification.delete', entity) %}
        {{ UI.deleteButton({
            dataUrl: path('ds_notification_api_rest_delete_notification', { id: entity.id }),
            dataRedirect: path('ds_notification_notification_index'),
            aCss: 'no-hash remove-button',
            id: 'btn-remove-tag',
            dataId: entity.id,
            entity_label: 'ds.notification.entity_label'|trans
        }) }}
        {{ UI.buttonSeparator() }}
    {% endif %}
    {{ UI.cancelButton(path('ds_notification_notification_index')) }}
    {% if resource_granted('ds.notification.notification.edit', entity) %}
        {% set html = UI.saveAndCloseButton() %}
        {% set html = html ~ UI.saveAndStayButton() %}
        {{ UI.dropdownSaveButton({ html: html }) }}
    {% endif %}
{% endblock navButtons %}

{% block pageHeader %}
    {% if entity.id %}
        {% set breadcrumbs = {
            entity: entity,
            indexPath: path('ds_notification_notification_index'),
            indexLabel: 'ds.notification.menu.index.label'|trans,
            entityTitle: entity.defaultTitle
        } %}
        {{ parent() }}
    {% else %}
        {% set title = 'oro.ui.create_entity'|trans({ '%entityName%': 'ds.notification.entity_label'|trans }) %}
        {% include 'OroUIBundle::page_title_block.html.twig' with { title: title } %}
    {% endif %}
{% endblock pageHeader %}

{% block content_data %}
    {% set dataBlocks = [] %}
    {% for widget in ds_widgets({ position: 'ds_notification_notification_form', context: context }, { form: form, context: context }) %}
        {% set dataBlocks = dataBlocks|merge([ {
            title: widget.title|trans,
            subblocks: [ {
                data : [ widget.content ]
            } ]
        } ]) %}
    {% endfor %}
    {% set id = 'notification-edit' %}
    {% set data = { dataBlocks: dataBlocks } %}
    {{ parent() }}
{% endblock content_data %}