attribution-1.0.x-dev/templates/attribution-creative-commons-icons.html.twig

templates/attribution-creative-commons-icons.html.twig
{#
/**
 * @file
 * Default theme implementation to display an attribution.
 *
 * Available variables:
 * - source.name: The name of the source.
 * - source.link: The link to the source.
 * - author.name: The name of the author.
 * - author.link: The link to the author.
 * - license: The associated license.
 * - license.id: The spdx license short code.
 * - license.name: The spdx license name.
 * - license.osiCertified: Is the license OSI certified?
 * - license.deprecated: Is the license deprecated?
 * - license.link: The link to the license.
 *
 * @ingroup themeable
 */
#}
{{ attach_library('attribution/attribution_creative_commons_icons') }}
{% set version = '' %}
<div class="attribution--license-icons">
  <a rel="license" href="{{ license.link }}" title="{{ license.name }}">
    {% set features = license.identifier|split('-') %}

    {% apply spaceless %}
      {% for feature in features %}
        {% if feature matches '/^[-+]?[0-9]*\\.?[0-9]+$/' %}
          {% set version = feature %}
          <i class="cc-icon-cc-version">&nbsp;<span>{{ feature|upper }}</span></i>
        {% else %}
          {% if version == '' %}
            {% if features[loop.index] matches '/^[-+]?[0-9]*\\.?[0-9]+$/' %}{% set last = true %}{% endif %}
            <i class="cc-icon-cc-{{ feature|lower }}"><span>{{ feature|upper }}</span></i><b>{% if last != true and loop.first != 1 and loop.last != 1 %}-{% else %}&nbsp;{% endif %}</b>
          {% elseif version != ''  %}
            <i class="cc-icon-cc-{{ feature|lower }}"><span>{{ feature|upper }}</span></i>
          {% endif %}
        {% endif %}
      {% endfor %}
    {% endapply %}

    {% if author.link %}
      <a href="{{ author.link }}">{{ author.name }}</a>
    {% endif %}
  </a>
</div>

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc