You are here

function template_preprocess_simple_timeline_fields in A Simple Timeline 7

Implements template_preprocess_hook().

Parameters

array $vars: The variables that will be passed to the template.

File

./simple_timeline.module, line 35
simple_timeline.module Created by JetBrains PhpStorm. User: alan

Code

function template_preprocess_simple_timeline_fields(&$vars) {
  $view =& $vars['view'];
  $options = $vars['options'];
  $vars['simple_timeline_date'] = $vars['simple_timeline_text'] = array();
  $vars['simple_timeline_image'] = NULL;
  foreach ($view->field as $id => $field) {
    $field_output = $view->field[$id]
      ->theme($vars['row']);
    if (in_array($id, array_filter($options['simple_timeline_date']))) {
      $vars['simple_timeline_date'][] = $field_output;
    }
    if (in_array($id, array_filter($options['simple_timeline_text']))) {
      $vars['simple_timeline_text'][] = $field_output;
    }
    if ($id == $options['simple_timeline_image']) {
      $vars['simple_timeline_image'] = $field_output;
    }
  }
  $vars['simple_timeline_date'] = implode($options['simple_timeline_date_separator'], $vars['simple_timeline_date']);
  $vars['simple_timeline_text'] = implode($options['simple_timeline_text_separator'], $vars['simple_timeline_text']);
}