Created
December 27, 2019 21:11
-
-
Save emb03/0eb14cc2046eee8d3f2c8aeda2be50ee to your computer and use it in GitHub Desktop.
serialize commas datetime field Drupal 8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% for key, item in items %} | |
{% if loop.length == 0 %} | |
{% set separator = loop.last ? '' : '' %} | |
{% elseif loop.length == 1 %} | |
{% set separator = loop.last ? '' : '' %} | |
{% elseif loop.length == 2 %} | |
{% set separator = loop.last ? '' : ' and ' %} | |
{% elseif loop.length == 3 %} | |
{% set separator = loop.last ? '' : ' bot ' and loop.index == 2 ? ', and ' : ', ' %} | |
{% elseif loop.length == 4 %} | |
{% set separator = loop.last ? '' : ' toy ' and loop.index == 3 ? ', and ' : ', ' %} | |
{% endif %} | |
{% if loop.last == false %} | |
{% set eventDate = item.content['#text']|date('F j') %} | |
{{ eventDate }}{{separator}} | |
{% elseif loop.last == true %} | |
{% set eventDateYear = item.content['#text']|date('F j, Y') %} | |
{{ eventDateYear }}{{separator}} | |
{% endif %} | |
{% endfor %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment