foreach loop

foreach loop

This code creates a new variable named links which is an array, and uses foreach statement to loop over each item inside this variables, items array, and it’s giving us the delta for each item, so field has multiple values like tags field. Delta represents which position or which delta that value is, so the first one will be delta[0] and second one will be delta[1], so forth, and item is going to be an actual item, a little chunk of renderable array that is when we look at kpr items.

$links = array();
 
foreach ($variables['items'] as $delta => $item) {
  $links[] = drupal_render($item);
}