You are here

name-item-list.html.twig in Name Field 8

Default theme implementation for name_item_list.

Available variables:

  • items: Keyed array of name components.
  • settings: Additional settings to control the parser.
  • original_count: Number of items before other preprocessing occur.
  • etal: Preprocessed Et-al abbreviation.
  • delimiter: Preprocessed delimiter.
  • items_count (optional): Number of items after other preprocessing have occured.
  • item (optional): Single item when only one name component is present.
  • name (optional): Available when there is only one items_count.
  • names (optional): Available when there is more than one items_count.
  • and_ (optional): Preprocessed "And" separator.

File

templates/name-item-list.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation for name_item_list.
  5. *
  6. * Available variables:
  7. * - items: Keyed array of name components.
  8. * - settings: Additional settings to control the parser.
  9. * - original_count: Number of items before other preprocessing occur.
  10. * - etal: Preprocessed Et-al abbreviation.
  11. * - delimiter: Preprocessed delimiter.
  12. * - items_count (optional): Number of items after other preprocessing have occured.
  13. * - item (optional): Single item when only one name component is present.
  14. * - name (optional): Available when there is only one items_count.
  15. * - names (optional): Available when there is more than one items_count.
  16. * - and_ (optional): Preprocessed "And" separator.
  17. *
  18. * @see template_preprocess_name_item_list()
  19. * @ingroup themeable
  20. */
  21. #}
  22. {% if items %}
  23. {% if original_count == 1 %}
  24. {{ item }}
  25. {% else %}
  26. {% if original_count > settings.multiple_el_al_min %}
  27. {% if items_count == 1 %}
  28. {{ '@name @etal'|t({'@name': name, '@etal': etal}) }}
  29. {% else %}
  30. {{ '@names@delimiter @etal'|t({'@names': names, '@delimiter': delimiter, '@etal': etal}) }}
  31. {% endif %}
  32. {% else %}
  33. {# Strange rule from http://citationstyles.org/downloads/specification.html. #}
  34. {% if (settings.multiple_delimiter_precedes_last == 'contextual' and original_count > 2) or settings.multiple_delimiter_precedes_last == 'always' %}
  35. {{ '@names@delimiter @and @lastname'|t({'@names': names, '@delimiter': delimiter, '@and': and_, '@lastname': lastname}) }}
  36. {% else %}
  37. {{ '@names @and @lastname'|t({'@names': names, '@and': and_, '@lastname': lastname}) }}
  38. {% endif %}
  39. {% endif %}
  40. {% endif %}
  41. {% endif %}