You are here

function twig_first in Translation template extractor 6.3

Same name and namespace in other branches
  1. 7.3 vendor/Twig/Extension/Core.php \twig_first()

Returns the first element of the item.

Parameters

Twig_Environment $env A Twig_Environment instance:

mixed $item A variable:

Return value

mixed The first element of the item

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

File

vendor/Twig/Extension/Core.php, line 738

Code

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