Display only last item in multifileld (files by media) I added one multifield - files with media widget.
Drupal rendered all items, but I need only last.
I can fix this by code below in template.php, but i don't know, it is good?

$i = 0;
while($i &lt; $items_count - 1) {
  unset($variables['content']['field_files'][$i]);
  unset($variables['content']['field_files']['$items'][$i]);
  $i++;
}


What is the best way?
You shouldn't unset array elements in tpl files. Instead, use hide() function:

Hides an element from later rendering.
The first time render() or drupal_render() is called on an element tree, as each element in the tree is rendered, it is marked with a #printed flag and the rendered children of the element are cached. Subsequent calls to render() or drupal_render() will not traverse the child tree of this element again: they will just use the cached children. So if you want to hide an element, be sure to call hide() on the element before its parent tree is rendered for the first time, as it will have no effect on subsequent renderings of the parent tree.