{# Prepares options for channel form and initialize page component params: form - Symfony\Component\Form\FormView entitiesMetadata - array of entities metadata #} {% macro initializeChannelForm(form, entitiesMetadata, customerIdentity) %} {% set options = { channelTypeEl: '#' ~ form.channelType.vars.id, channelEntitiesEl: '#' ~ form.entities.vars.id, customerIdentity: customerIdentity, entitiesMetadata: entitiesMetadata, fields: { status: '#' ~ form.status.vars.id, name: '#' ~ form.name.vars.id, channelType: '#' ~ form.channelType.vars.id, tokenEl: '#' ~ form._token.vars.id } } %}
{% endmacro %} {# Renders and initialize entity list compoenent in view mode params: channel - OroCRM\Bundle\ChannelBundle\Entity\Channel #} {% macro inializeEntitiesViewComponent(channel) %} {% set containerIdentifier = 'entities-list-view' %} {% endmacro %} {# Renders channel property for entities that aware of it. Check wheter view of channel is allowed then renders link to channel view page. params: entity - entity instanse of OroCRM\Bundle\ChannelBundle\Model\ChannelAwareInterface params - set of params required for render(e.g. label etc..) #} {% macro renderChannelProperty(entity, params = {}) %} {% import 'OroUIBundle::macros.html.twig' as UI %} {% set label = params.label is defined ? params.label : oro_entity_config_value('OroCRM\\Bundle\\ChannelBundle\\Entity\\Channel', 'label') %} {%- if entity.dataChannel and resource_granted('VIEW', entity.dataChannel) -%} {% set channelView = '' ~ entity.dataChannel.name|escape ~ '' %} {%- else -%} {% set channelView = entity.dataChannel ? entity.dataChannel : '' %} {%- endif -%} {{ UI.renderHtmlProperty(label|trans, channelView) }} {% endmacro %}