drupal-caravane/web/themes/custom/caravane/templates/views-view-field--block-2--...

43 lines
1.4 KiB
Twig
Raw Normal View History

{#
/**
* @file
* Default theme implementation for a single field in a view.
*
* Available variables:
* - view: The view that the field belongs to.
* - field: The field handler that can process the input.
* - row: The raw result of the database query that generated this field.
* - output: The processed output that will normally be used.
*
* When fetching output from the row this construct should be used:
* data = row[field.field_alias]
*
* The above will guarantee that you'll always get the correct data, regardless
* of any changes in the aliasing that might happen if the view is modified.
*
* @see template_preprocess_views_view_field()
*
* @ingroup themeable
*/
#}
<div>
{% if output %}
{% set separated_contents = output|split('\n') %}
{% for content in separated_contents %}
{% if (content|trim ends with ')') %}
{% if content != '' %}
<div class="separated-content">
{{ content|trim|slice(0, -12) }}
<span>{{ content|trim|slice(-7, content|trim|length - 1)|slice(0, -4) }})</span></a>
</div>
{% endif %}
{% else %}
{% if content != '' %}
<div class="separated-content">{{ content|trim }}</div>
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
</div