Returns the first element of the item.
Twig_Environment $env A Twig_Environment instance:
mixed $item A variable:
mixed The first element of the item
function twig_first(Twig_Environment $env, $item) {
$elements = twig_slice($env, $item, 0, 1, false);
return is_string($elements) ? $elements[0] : current($elements);
}