{% macro collection_prototype(widget) %} {% if 'prototype' in widget.vars|keys %} {% set form = widget.vars.prototype %} {% set name = widget.vars.prototype.vars.name %} {% else %} {% set form = widget %} {% set name = widget.vars.full_name %} {% endif %}
{{ form_errors(form) }} {% if form.children|length %} {% for child in form %} {{ form_widget(child) }} {{ form_errors(child) }} {% endfor %} {% else %} {{ form_widget(form) }} {% endif %} {{ form_rest(form) }}
{% endmacro %} {% macro tooltip(tooltip_raw, tooltip_parameters, tooltip_placement, details_enabled, details_link, details_anchor) %} {% set tooltip_parameters = tooltip_parameters|default({}) %} {# deprecated tooltips domain since 1.9:1:11 for tooltips use instead 'messages' translation domain #} {% set tooltip = tooltip_raw|trans(tooltip_parameters, "messages") %} {% if (tooltip == tooltip_raw) %} {% set tooltip = tooltip_raw|trans(tooltip_parameters, "tooltips") %} {% endif %} {% if tooltip is not empty %} {% set details_anchor = details_anchor|default(null) %} {% set details_link = details_link|default(null) %} {% set details_enabled = details_enabled|default(false) %} {% set tooltip_placement = tooltip_placement|default(null) %} {# Help link logic #} {% if details_enabled or details_anchor or details_link %} {% set helpLink = details_link|default(get_help_link()) %} {% if details_anchor %} {% set helpLink = helpLink ~ '#' ~ details_anchor %} {% endif %} {% set tooltip = tooltip ~ '
' ~ 'oro.form.tooltip.read_more'|trans ~ '
' %} {% endif %} {# End help link logic #} {% set tooltip = '
' ~ tooltip ~ '
' %} {% endif %} {% endmacro %} {# Render attribute row Parameters: title - attribute title value - attribute value additionalData - array with additional data #} {% macro attibuteRow(title, value, additionalData) %} {% set attributeValue %}
{% if value.value is not defined %}
{{ value }}
{% else %}
{{ value.value }} {{ value.hint }}
{% endif %}
{% if additionalData|length %} {% for data in additionalData.data %}
{{ attribute(data, additionalData.field) }}
{% endfor %} {% endif %} {% endset %} {{ _self.renderAttribute(title, attributeValue) }} {% endmacro %} {# Render attribute row with custom data block Parameters: title - row title data - row data #} {% macro renderAttribute(title, data) %}
{{ data|raw }}
{% endmacro %} {# Render property block Parameters: title - property title data - property data entity - the entitty instance on wich Field ACL should be checked fieldName - the name of field on wich Field ACL should be checked #} {% macro renderProperty(title, data, entity = null, fieldName = null) %} {{ _self.renderHtmlProperty(title, data|escape, entity, fieldName) }} {% endmacro %} {# Render html property block Parameters: title - property title data - property data entity - the entitty instance on wich Field ACL should be checked fieldName - the name of field on wich Field ACL should be checked #} {% macro renderHtmlProperty(title, data, entity = null, fieldName = null) %} {% if entity is defined and fieldName is defined and not resource_granted('VIEW', entity, fieldName) %} {% else %} {{ _self.renderAttribute(title, '
' ~ data|default('oro.ui.empty'|trans) ~ '
') }} {% endif %} {% endmacro %} {# Render html property block. HTML rendering may be switched off with system config. Parameters: title - property title data - property data #} {% macro renderSwitchableHtmlProperty(title, data) %} {% if not oro_config_value('oro_form.wysiwyg_enabled') %} {% set data = data|striptags('')|raw|nl2br %} {% endif %} {{ _self.renderAttribute(title, '
' ~ data|default('oro.ui.empty'|trans) ~ '
') }} {% endmacro %} {# Render color property block Parameters: title - property title data - property data empty - a value which should be used if data is empty #} {% macro renderColorProperty(title, data, empty) %} {% if data is not none %} {% set data = '' ~ data ~ '' %} {% endif %} {{ _self.renderAttribute(title, '
' ~ data|default(empty)|default('oro.ui.empty'|trans) ~ '
') }} {% endmacro %} {# Create the link Parameters - array: [ 'path' - button url 'class' - default class 'aCss' - additional button class 'title' - button title 'iCss' - css class for 'i' tag (icon) 'label' - button label ] #} {% macro link(parameters) %} {# need to remove spaces just before label #} {% set iconHtml = '' %} {% if parameters.iCss is defined %} {% set iconHtml %} {{ parameters.label }} {% endset %} {% else %} {% endif %} {% spaceless %}
{{ iconHtml|trim|raw }}{{ parameters.label|trim }} {% endspaceless %} {% endmacro %} {# Create the button Parameters - array: [ 'path' - button url 'aCss' - additional button class 'title' - button title 'iCss' - css class for 'i' tag (icon) 'label' - button label ] #} {% macro button(parameters) %}
{{ _self.link(parameters|merge({'class': 'btn back icons-holder-text'})) }}
{% endmacro %} {# Create dropdown button Parameters - array: [ 'label' - button label 'elements' - dropdown elements 'html' - html from placeholder 'aCss' - additional drop down class ] #} {% macro dropdownButton(parameters) %}
{% if parameters.iCss is defined %} {% endif %} {{ parameters.label }}
{% endmacro %} {# Create the dropdown button item Parameters - array: [ 'path' - button url 'aCss' - additional button class 'title' - button title 'iCss' - css class for 'i' tag (icon) 'label' - button label ] #} {% macro dropdownItem(parameters) %}
  • {{ _self.link(parameters) }}
  • {% endmacro %} {# Create the dropdown button wich preserves last used button Parameters - array: [ 'html' - original buttons markup 'groupKey' - key, to remember last used button 'options' - options for pinnedDropdownButtonProcessor widget ] #} {% macro pinnedDropdownButton(parameters) %} {% if isDesktopVersion() or parameters.mobileEnabled|default(false) %} {% set options = parameters.options|default({}) %} {% set options = options|merge({ widgetModule: options.widgetModule|default('oroui/js/content-processor/pinned-dropdown-button'), widgetName: options.widgetName|default('pinnedDropdownButtonProcessor'), groupKey: parameters.groupKey is defined ? parameters.groupKey : '', useMainButtonsClone: true }) %} {% spaceless %}
    {{ parameters.html|raw }}
    {% endspaceless %} {% else %} {{ parameters.html|raw }} {% endif %} {% endmacro %} {# Predefiend pinnedDropdownButton's settings for save button #} {% macro dropdownSaveButton(parameters) %} {% set parameters = { 'groupKey': 'saveButtons', 'options': { 'moreButtonAttrs': { 'class': 'btn-success' } } }|merge(parameters|default({})) %} {{ _self.pinnedDropdownButton(parameters) }} {% endmacro %} {# Create 'Cancel' button Parameters 'path' - button url 'label' - button label | 'Cancel' by default #} {% macro cancelButton(path, label) %} {% if label is empty %} {% set label = 'Cancel'|trans %} {% endif %} {{ _self.button({'path' : path, 'title' : label, 'label' : label, data: {action: 'cancel'} }) }} {% endmacro %} {# Create 'Edit' button Parameters - array: [ 'path' - button url 'aCss' - additional button class 'title' - button title | 'Edit' by default 'label' - button label | 'Edit' by default 'entity_label' - if specified will be added for title and label ] #} {% macro editButton(parameters) %} {% set iCss = ['icon-edit'] %} {% set aCss = ['edit-button', 'main-group'] %} {% if parameters.iCss is defined %} {% set iCss = parameters.iCss|split(' ')|merge(iCss) %} {% endif %} {% if parameters.aCss is defined %} {% set aCss = parameters.aCss|split(' ')|merge(aCss) %} {% endif %} {% if parameters.title is defined %} {% set title = parameters.title %} {% else %} {% set title = parameters.entity_label is defined ? 'oro.ui.edit_entity'|trans({'%entityName%': parameters.entity_label}) : 'oro.ui.edit'|trans %} {% endif %} {% set label = parameters.label is defined ? parameters.label : 'oro.ui.edit'|trans %} {% set parameters = parameters|merge({ 'iCss': iCss|join(' '), 'aCss': aCss|join(' '), 'title': title, 'label': label }) %} {# Add URL parameters to button path #} {% set parameters = parameters|merge({ 'path' : oro_url_add_query(parameters['path']) }) %} {{ _self.button(parameters) }} {% endmacro %} {# Create 'add' button Parameters - array: [ 'path' - button url 'aCss' - additional button class 'title' - button title | 'Create' by default 'label' - button label | 'Create' by default 'entity_label' - if specified will be added for title and label ] #} {% macro addButton(parameters) %} {% if parameters.label is defined %} {% set label = parameters.label %} {% else %} {% set label = parameters.entity_label is defined ? 'oro.ui.create_entity'|trans({'%entityName%': parameters.entity_label}) : 'oro.ui.create'|trans %} {% endif %} {% if parameters.title is defined %} {% set title = parameters.title %} {% else %} {% set title = parameters.entity_label is defined ? 'oro.ui.create_entity'|trans({'%entityName%': parameters.entity_label}) : 'oro.ui.create'|trans %} {% endif %} {{ label }} {% endmacro %} {# Delete button with javascript handler Parameters - array: [ 'aCss' - additional css class for 'a' tag 'dataId' - data-id parameter 'dataMessage' - message before delete record | 'Are you sure you want to delete this %entity_label%?' by default 'dataRedirect' - url to redirect after delete | '%entity_label% deleted' by default 'dataUrl' - data-url parameter 'title' - button title | 'Delete' by default 'label' - button label | 'Delete' by default 'entity_label' - if specified will be added for title, label and messages| 'item' by default 'disabled' - if true this control is rendered as disabled ] #} {% macro deleteButton(parameters) %} {% set aCss = 'btn icons-holder-text' %} {% if parameters.disabled is defined and parameters.disabled %} {% set aCss = aCss ~ ' disabled' %} {% endif %} {% if parameters.aCss is defined %} {% set aCss = aCss ~ ' ' ~ parameters.aCss %} {% endif %} {% set parameters = parameters|merge({'aCss': aCss}) %}
    {{ _self.deleteLink(parameters) }}
    {% endmacro %} {% macro deleteLink(parameters) %} {% set entityLabel = parameters.entity_label is defined ? parameters.entity_label : 'oro.ui.item'|trans %} {% set label = parameters.label is defined ? parameters.label : 'oro.ui.delete'|trans %} {% if parameters.title is defined %} {% set title = parameters.title %} {% else %} {% set title = parameters.entity_label is defined ? 'oro.ui.delete_entity'|trans({'%entityName%': parameters.entity_label}) : 'oro.ui.delete'|trans %} {% endif %} {% set message = parameters.dataMessage is defined ? parameters.dataMessage : 'oro.ui.delete_confirm'|trans({ '%entity_label%' : entityLabel }) %} {% set successMessage = parameters.successMessage is defined ? parameters.successMessage : 'oro.ui.delete_message'|trans({ '%entity_label%' : entityLabel }) %} {% set url = parameters.dataUrl is defined ? parameters.dataUrl : '' %} {% set linkParams = { 'data': { 'message': message, 'success-message': successMessage, 'url': url }, 'iCss': 'icon-trash', 'aCss': parameters.aCss, 'title': title, 'label': label, 'path': 'javascript:void(0);' } %} {% if (parameters.dataId is defined) %} {% set data = linkParams.data|merge({'id': parameters.dataId}) %} {% set linkParams = linkParams|merge({ 'data': data }) %} {% endif %} {% if parameters.dataRedirect is defined %} {% set data = linkParams.data|merge({'redirect': parameters.dataRedirect}) %} {% set linkParams = linkParams|merge({ 'data': data }) %} {% endif %} {% if parameters.data is defined %} {% for dataItemName,dataItemValue in parameters.data %} {% set data = linkParams.data|merge({(dataItemName): dataItemValue}) %} {% set linkParams = linkParams|merge({ 'data': data }) %} {% endfor %} {% endif %} {{ _self.link(linkParams) }} {% endmacro %} {# A button with javascript handler Parameters - array: [ 'class' - default class 'aCss' - additional css class for 'a' tag 'iCss' - additional css class for 'i' tag 'dataId' - data-id parameter 'dataUrl' - data-url parameter 'dataRedirect' - url to redirect after an operation finished 'successMessage' - a message which will be shown after an operation finished 'title' - button title 'label' - button label 'visible' - determined whether the button is visible or not. Defaults to true, 'dataAttributes' - additional data attributes ] #} {% macro clientLink(parameters) %} {% spaceless %} {% endspaceless %} {% endmacro %} {# Renders page component attributes passed in array Parameters - array: [ 'module' - module name to load, will be loaded through RequireJS 'options' - options to pass into page-component ] #} {% macro renderPageComponentAttributes(pageComponent) %} data-page-component-module="{{ pageComponent.module }}" {% if pageComponent.options is defined %} data-page-component-options="{{ pageComponent.options|json_encode }}" {% endif %} {% if pageComponent.name is defined %} data-page-component-name="{{ pageComponent.name }}" {% endif %} {% if pageComponent.layout is defined %} data-layout="{{ pageComponent.layout }}" {% endif %} {% endmacro %} {# Renders attributes for widget Parameters: options array for widget #} {% macro renderWidgetAttributes(options) %} {% set pageComponent = { module: "oroui/js/app/components/widget-component", options: options } %} {% if options.options.pageComponentName is defined %} {% set pageComponent = pageComponent|merge({name: options.options.pageComponentName}) %} {% endif %} {{ _self.renderPageComponentAttributes(pageComponent) }} {% endmacro %} {# @deprecated Please use renderWidgetAttributes() with createOnEvent option specified instead #} {% macro renderWidgetDataAttributes(options) %} {% if (options.createOnEvent is not defined) %} {% set options = options|merge({ 'createOnEvent' : options.event|default('click') }) %} {% endif %} {{ _self.renderWidgetAttributes(options) }} {% endmacro %} {% macro renderAttributes(options, prefix) %} {% for name, value in options %} {% if (value is iterable) %} {% set value = value|json_encode(constant('JSON_FORCE_OBJECT')) %} {% endif %} data-{% if prefix is not empty %}{{ prefix }}-{% endif %}{{ name }}="{{ value }}" {% endfor %} {% endmacro %} {# A button with javascript handler Parameters - array: [ 'class' - default class 'aCss' - additional css class for 'a' tag 'iCss' - additional css class for 'i' tag 'dataId' - data-id parameter 'dataUrl' - data-url parameter 'dataRedirect' - url to redirect after an operation finished 'successMessage' - a message which will be shown after an operation finished 'title' - button title 'label' - button label 'visible' - determined whether the button is visible or not. Defaults to true ] #} {% macro clientButton(parameters) %} {#{% espaceless %}#}
    {{ _self.clientLink(parameters|merge({'class': 'btn icons-holder-text'})) }}
    {#{% endspaceless %}#} {% endmacro %} {# A button with javascript handler Parameters - array: [ 'class' - default class 'aCss' - additional css class for 'a' tag 'iCss' - additional css class for 'i' tag 'dataId' - data-id parameter 'dataUrl' - data-url parameter 'dataRedirect' - url to redirect after an operation finished 'successMessage' - a message which will be shown after an operation finished 'title' - button title 'label' - button label 'visible' - determined whether the button is visible or not. Defaults to true ] #} {% macro dropdownClientItem(parameters) %}
  • {{ _self.clientLink(parameters) }}
  • {% endmacro %} {# Outputs a button with "Save and Close" label. After save application will show a page configured by parameter with name "action". For parameters description see documentation of saveActionButton macros. For backward compatibility macros supports input parameter as a label of button. #} {% macro saveAndCloseButton(parametersOrLabel) %} {% set defaultParameters = { 'class': 'btn-success', 'label': 'Save and Close'|trans } %} {% if parametersOrLabel is iterable %} {% set parameters = parametersOrLabel %} {% else %} {# @deprecated since 1.10, support backward compatibility #} {% set parameters = { 'label': parametersOrLabel|default('Save and Close'|trans), 'action': 'save_and_close' } %} {% endif %} {% set parameters = defaultParameters|merge(parameters) %} {{ _self.saveActionButton(parameters) }} {% endmacro %} {# Outputs a button with "Save and Stay" label. After save application will show a page configured by parameter with name "action". For parameters description see documentation of saveActionButton macros. For backward compatibility macros supports input parameter as a label of button. #} {% macro saveAndStayButton(parametersOrLabel) %} {% if parametersOrLabel is iterable %} {% set parameters = parametersOrLabel %} {% else %} {# @deprecated since 1.10, support backward compatibility #} {% set parameters = { 'label': parametersOrLabel|default('Save'|trans), 'action': 'save_and_stay' } %} {% endif %} {{ _self.saveActionButton(parameters) }} {% endmacro %} {# Outputs a button with "Save and New" label. After save application will show a page configured by parameter with name "action". For parameters description see documentation of saveActionButton macros. #} {% macro saveAndNewButton(parameters) %} {% set defaultParameters = { 'label': 'Save and New'|trans } %} {% set parameters = defaultParameters|merge(parameters) %} {{ _self.saveActionButton(parameters) }} {% endmacro %} {# Outputs generic button with "Save" label and redirect behavior. Redirect is configured with parameter "route" and "route_params". Route params could contain paths instead of values if value will be available only after save. Parameters - array [ 'type' - button type, should be "button" or "submit" 'class' - CSS class 'label' - label of button 'route' - Optional name of route to make a redirect. 'params' - Optional list of route parameters. In case if value of parameter will be available only after save you can pass property path. For example: ['id': '$id']. '$' at the means property path. So when controller will handle save it will redirect to route using actual id value of entity. 'action' - Contains data used by controller to make redirect. This value is prepared automatically based on route and route_params so you don't need to use this attribute directly. ] #} {% macro saveActionButton(parameters) %} {% set defaultParameters = { 'type' : 'submit', 'class': 'btn-success main-group', 'label': 'Save'|trans, } %} {% if parameters.action is defined %} {# @deprecated since 1.10, support backward compatibility #} {% elseif parameters.route is defined %} {# Prepare action parameter based on route #} {% set action = {'route': parameters.route} %} {% if parameters.params is defined %} {% set action = action|merge({'params': parameters.params}) %} {% endif %} {% set parameters = parameters|merge({'action': action|json_encode}) %} {% endif %} {% set parameters = defaultParameters|merge(parameters) %} {{ _self.buttonType(parameters) }} {% endmacro %} {# Button macros with custom button type Parameters - array: [ 'type' - button type 'class' - additional button css classes 'label' - label of button ] #} {% macro buttonType(parameters) %}
    {% endmacro %} {# Separator between buttons #} {% macro buttonSeparator() %}
    {% endmacro %} {# Create scroll sub block for scroll block Parameters: title - title of sub block data - array with data fields (i.e. form_row() or attibuteRow() data) isForm - flag what scroll block mut contain the form useSpan - flag to indicate is subblock must have css class specified in spanClass parameter or not spanClass - css class name of subblock, if this parameter is not specified the css class is span6 #} {% macro scrollSubblock(title, data, isForm, useSpan, spanClass) %} {% set spanClass = spanClass|default('responsive-cell') %} {#% if useSpan is not defined or useSpan == true %} {% set span = spanClass %} {% else %} {% set span = '' %} {% endif %} {% if span %}
    {% endif %#}
    {% if title|length %}
    {{ title }}
    {% endif %} {% for dataBlock in data %} {{ dataBlock|raw }} {% endfor %}
    {#% if span %}
    {% endif %#} {% endmacro %} {# Create scroll block for scroll data area Parameters: blockId - id of block title - block title 'subblocks' - array with scroll sub blocks: [ 'title' - title of sub block 'data' - array with data fields (i.e. form_row() or attibuteRow() data) ] isForm - flag what scroll block mut contain the form contentAttributes - additional attributes for block content useSubBlockDivider - indicates if 'row-fluid-divider' css class should be added to a row when there are more than one subblocks #} {% macro scrollBlock(blockId, title, subblocks, isForm, contentAttributes, useSubBlockDivider) %} {% set cols = subblocks|length %}

    {{ title }}

    {% if isForm is defined and isForm == true %}
    {% else %}
    {% endif %} {% for subblock in subblocks %} {{ _self.scrollSubblock(subblock.title is defined and subblock.title|length ? subblock.title : null, subblock.data, isForm, subblock.useSpan is defined ? subblock.useSpan : true, subblock.spanClass is defined ? subblock.spanClass : '') }} {% endfor %} {% if isForm is defined and isForm == true %}
    {% else %}
    {% endif %}
    {% endmacro %} {# Create scroll blocks (like in view or update pages) Parameters: dataTarget - id of scroll block data - array with scroll data blocks form data parameter structure: [ 'dataBlocks' - array of blocks. each block consist of: [ 'title' - title of scroll block 'priority' - a number that can be used to change the order of blocks 'class' - additional css class for scroll block menu item 'useSubBlockDivider' - [optional] indicates if 'row-fluid-divider' css class should be added to a row when there are more than one subblocks 'subblocks' - array with scroll sub blocks: [ 'title' - title of sub block 'data' - array with data fields (i.e. form_row() or attibuteRow() data) ] ] 'formErrors' - errors from the form 'hiddenData' - additional data (hidden fields from the form) ] #} {% macro scrollData(dataTarget, data, form = null) %} {% set data = oro_ui_scroll_data_before(dataTarget, data, form) %} {% if form is defined and form %} {% set isForm = true %} {% else %} {% set isForm = false %} {% endif %} {% set dataBlocks = data.dataBlocks|oro_sort_by %}
    {% if data.formErrors is defined and data.formErrors | length%}
    {{ data.formErrors|raw }}
    {% endif %}
    {% for scrollBlock in dataBlocks %} {{ _self.scrollBlock("scroll-" ~ loop.index, scrollBlock.title, scrollBlock.subblocks, isForm, scrollBlock.content_attr is defined ? scrollBlock.content_attr : null, scrollBlock.useSubBlockDivider is defined ? scrollBlock.useSubBlockDivider : true) }} {% endfor %} {% if data.hiddenData is defined or isForm %}
    {% if data.hiddenData is defined %} {{ data.hiddenData|raw }} {% endif %} {% if isForm %} {{ form_rest(form) }} {% endif %}
    {% endif %}
    {% endmacro %} {# Create collection field block Parameters: field - form collection field label - label of block buttonCaption - Caption of add entity button #} {% macro collectionField(field, label, buttonCaption) %}
    {% for emailField in field.children %} {{ _self.collection_prototype(emailField) }} {% endfor %}
    {{ buttonCaption }}
    {% endmacro %} {# Render attributes of HTML element. Parameters: attr - attributes excludes - names of attributes which should not be rendered even if they exist in attr parameter #} {% macro attributes(attr, excludes) %} {% spaceless %} {% set attr = attr|default({}) %} {% for attrname, attrvalue in attr %}{% if not excludes is defined or not excludes[attrname] is defined %}{% if attrname in ['placeholder', 'title'] %}{{ attrname }}="{{ attrvalue|trans({}, translation_domain) }}" {% else %}{{ attrname }}="{{ attrvalue }}" {% endif %}{% endif %}{% endfor %} {% endspaceless %} {% endmacro %} {# Render link to entity owner Parameters: entity - entity record renderLabel - need render default label #} {%- macro entityOwnerLink(entity, renderLabel = true) -%} {% spaceless %} {%- if entity %} {% set ownerType = oro_get_owner_type(entity) %} {%- if ownerType %} {% if resource_granted('VIEW', entity, oro_get_owner_field_name(entity)) %} {% set owner = oro_get_entity_owner(entity) %} {% if owner %} {% if (ownerType == 'USER') %} {% set ownerPath = path('oro_user_view', {'id': owner.id}) %} {% set ownerName = owner|oro_format_name %} {% elseif (ownerType == 'BUSINESS_UNIT') %} {% set ownerPath = path('oro_business_unit_view', {'id': owner.id}) %} {% set ownerName = owner.name %} {% endif %} {% if ownerName is defined %} {% if renderLabel %} {% set entityClassName = oro_class_name(entity) %} {{ oro_field_config_value( entityClassName, oro_entity_config_value(entityClassName, 'owner_field_name', 'ownership'), 'label' )|trans }}: {% endif %} {% if ownerPath is defined and resource_granted('VIEW', owner) %} {{ _self.renderUrl(ownerPath, ownerName) }} {% else %} {{ ownerName }} {% endif %} {% endif %} {% endif %} {% endif %} {% endif -%} {% endif -%} {% endspaceless %} {%- endmacro -%} {%- macro renderUrl(url, title, class) -%} {% spaceless %} {% if title is empty %} {% set title = url %} {% endif %} {% if class is empty %} {% set class = '' %} {% endif %} {% if url is not empty %} {{ title }} {% endif %} {% endspaceless %} {%- endmacro -%} {%- macro renderPhone(phone, title) -%} {% if title is empty %} {% set title = phone %} {% endif %} {% if phone is not empty %} {{ title }} {% endif %} {%- endmacro -%} {# Render phone number with related actions block Parameters: phone - PhoneInterface object or string entity - related entity record #} {% macro renderPhoneWithActions(phone, entity) -%} {% if phone is not empty %} {%- set actions %} {%- placeholder phone_actions with {phone: phone, entity: entity} -%} {% endset -%} {% set actions = actions|trim %} {{ _self.renderPhone(phone) }} {% if actions is not empty -%} {{ actions|raw }} {%- endif %} {% endif %} {%- endmacro %} {% macro getApplicableForUnderscore(str) %} {{ str|replace({ "', "', "<%": '<% print("<" + "%"); %>', "%>": '<% print("%" + ">"); %>', })|raw }} {% endmacro %} {%- macro renderList(elements) -%} {% endmacro %} {%- macro renderTable(titles, rows, style) -%} {%- for title in titles %} {% endfor -%} {%- for row in rows %} {%- for element in row %} {% endfor -%} {% endfor -%}
    {{ title }}
    {{ element }}
    {% endmacro %} {%- macro entityViewLink(entity, label, route, permission) -%} {% if entity %} {% if route and resource_granted(permission|default('VIEW'), entity) %} {{ _self.renderUrl(path(route, {'id': entity.id}), label) }} {% else %} {{ label|escape }} {% endif %} {% endif %} {%- endmacro -%} {%- macro entityViewLinks(entities, labelProperty, route, permission) -%} {% set links = [] %} {% for entity in entities %} {% set links = links|merge([_self.entityViewLink(entity, attribute(entity, labelProperty), route, permission)]) %} {% endfor %} {{ _self.renderList(links) }} {%- endmacro -%} {# Renders text that should be rendered instead of not accessable entity field Parameters: labelText - Text that should be rendered #} {%- macro renderDisabledLabel(labelText) -%} {{ labelText }} {%- endmacro -%} {# Renders entity label by it's field. In case if VIEW permission is notgranted, returns the 'view entity_name' string in case if entityLabelIfNotGranted was set and empty string otherwise Parameters: entity - Entity whete field value should be takes fieldName - Field name wich value should be rendered entityLabelIfNotGranted - Entity label that should be rendered in case if user have no access to see field value #} {%- macro renderEntityViewLabel(entity, fieldName, entityLabelIfNotGranted = null) -%} {% if entity is not null and resource_granted('VIEW', entity, fieldName) %} {{ attribute(entity, fieldName) }} {% else %} {% if entityLabelIfNotGranted is not null %} {{ 'view %entityName%'|trans({'%entityName%' : entityLabelIfNotGranted|trans}) }} {% endif %} {% endif %} {%- endmacro -%}