PHP Classes

File: templates/nbg-currency.html.twig

Recommend this page to a friend!
  Classes of Temuri Takalandze  >  Drupal NBG Currency  >  templates/nbg-currency.html.twig  >  Download  
File: templates/nbg-currency.html.twig
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Drupal NBG Currency
Drupal module to show currency values with NBG API
Author: By
Last change:
Date: 1 year ago
Size: 1,213 bytes
 

Contents

Class file image Download
{#
/**
 * @file
 * Template for the NBG Currency block.
 *
 * Available variables:
 * - currency_data: Array of currency data.
 * - module_path:   Path to module.
 */
#}

{% if currency_data is empty %}
  <h1>{{ 'The list of currencies is empty.'|trans }}</h1>
{% else %}
  <table>
    <tbody>
    {% for k, v in currency_data %}
      {% if v.rate == -1 %}
        {% set change_class = 'nbg-currency-decreased' %}
        {% set change_status = 'Decreased by %change%' %}
      {% elseif v.rate == 1 %}
        {% set change_class = 'nbg-currency-increased' %}
        {% set change_status = 'Increased by %change%' %}
      {% else %}
        {% set change_class = null %}
        {% set change_status = 'Unchanged' %}
      {% endif %}
      <tr>
        <td title="{{ v.title }}" class="nbg-currency-td-flag">
          <img src="/{{ module_path }}/images/flags/{{ k|lower }}.png" alt="{{ k }}">
        </td>
        <td title="{{ v.description|trans }}">{{ v.currency }}</td>
        <td class="{{ change_class }}"
            title="{{ change_status|trans({ '%change%': v.change|abs })|striptags }}">
          {{ v.change }}
        </td>
      </tr>
    {% endfor %}
    </tbody>
  </table>
{% endif %}
For more information send a message to info at phpclasses dot org.