You are here

public function SlickViews::getFieldValue in Slick Views 7.2

Returns the values for the expected Title, ER, List, Term.

1 call to SlickViews::getFieldValue()
SlickViews::buildElements in ./SlickViews.inc
Returns slick contents.

File

./SlickViews.inc, line 334
Slick style plugin for the Views module.

Class

SlickViews
Implements a style type plugin for the Views module.

Code

public function getFieldValue($row, $field_name, $index) {
  $values = array();

  // Content title/List/Text, either as link or plain text.
  // @todo recheck multi-values.
  if ($value = $this
    ->get_field_value($index, $field_name)) {
    if (is_array($value)) {
      foreach (array_filter($value) as $key => $val) {
        $v = isset($val['value']) ? $val['value'] : $val;
        $value[$key] = drupal_clean_css_identifier(drupal_strtolower($v));
      }
    }
    $string = is_string($value) ? $value : implode(' ', $value);
    $values[$index] = empty($string) ? '' : $string;
  }
  elseif ($renderable = $this
    ->getFieldData($row, $field_name, TRUE)) {
    $value = array();
    foreach ($renderable as $key => $render) {
      $class = '';
      if (isset($render['rendered']['#title'])) {
        $class = $render['rendered']['#title'];
      }
      elseif (isset($render['raw']['value'])) {
        $class = $render['raw']['value'];
      }
      $class = $class ? $class : drupal_render($render['rendered']);
      $class = strip_tags($class);
      $value[$key] = drupal_clean_css_identifier(drupal_strtolower($class));
    }
    $values[$index] = empty($value) ? '' : implode(' ', $value);
  }
  return $values;
}