You are here

function template_preprocess_views_galleriffic_view_gallerifficrows in Views Galleriffic 6

Same name and namespace in other branches
  1. 7 views_galleriffic.module \template_preprocess_views_galleriffic_view_gallerifficrows()

Implementation of template preprocess for the view fields

File

./views_galleriffic.module, line 67

Code

function template_preprocess_views_galleriffic_view_gallerifficrows(&$vars) {
  $exit = 0;
  $view = $vars['view'];
  $options = $vars['options'];
  $vars['fields'] = array();

  // ensure it's at least an empty array.
  foreach ($view->field as $id => $field) {
    $field_output = $view->field[$id]
      ->theme($vars['row']);
    $object = new stdClass();
    $object->content = $field_output;
    $object->download_original = $view->style_options['download'];

    // find the option (ie title, description, slide, thumbnail)  for the field
    foreach ($options as $field_title => $field_label) {
      if ($field_label == $id) {
        $object->option = $field_title;
      }
    }
    $vars['fields'][$object->option] = $object;

    //cleaning up fields for output. imho views should take care of this but am checking anyway
    $vars['fields']['title_field']->content = check_markup($vars['fields']['title_field']->content, $format = FILTER_FORMAT_DEFAULT, $check = FALSE);
    $vars['fields']['description_field']->content = check_markup($vars['fields']['description_field']->content, $format = FILTER_FORMAT_DEFAULT, $check = FALSE);
    if ($vars['fields']['slide_field']->content) {
      $vars['fields']['slide_field']->content = url($vars['fields']['slide_field']->content);
    }
    $vars['fields']['thumbnail_field']->content = url($vars['fields']['thumbnail_field']->content);

    //remove any tags and then remove any special characters for inclusion in img and href
    $vars['fields']['title_field']->stripped = htmlspecialchars(strip_tags($vars['fields']['title_field']->content));
  }
}