function twig_last

Returns the last element of the item.

Parameters

Twig_Environment $env A Twig_Environment instance:

mixed $item A variable:

Return value

mixed The last element of the item

1 string reference to 'twig_last'
Twig_Extension_Core::getFilters in drupal/core/vendor/twig/twig/lib/Twig/Extension/Core.php
Returns a list of filters to add to the existing list.

File

drupal/core/vendor/twig/twig/lib/Twig/Extension/Core.php, line 663

Code

function twig_last(Twig_Environment $env, $item) {
  $elements = twig_slice($env, $item, -1, 1, false);
  return is_string($elements) ? $elements[0] : current($elements);
}