You are here

function wsfields_views_handler_field::get_value in Web Service Data 7

Return the entity object or a certain property of the entity.

Overrides views_handler_field_entity::get_value

1 call to wsfields_views_handler_field::get_value()
wsfields_views_handler_field::render in modules/wsfields_views/handlers/wsfields_views_handler_field.inc
Render the field.

File

modules/wsfields_views/handlers/wsfields_views_handler_field.inc, line 15
Definition of wsfields_views_handler_field.

Class

wsfields_views_handler_field
Field handler to present data from wsfields

Code

function get_value($values, $field = NULL) {
  $field = $this->field;
  if (isset($this->entities[$this->view->row_index])) {
    $entity = $this->entities[$this->view->row_index];

    // Support to get a certain part of the entity.
    if (isset($field) && isset($entity->{$field})) {
      $ret = array();
      $field_info = field_info_field($field);
      if (isset($field_info['translatable']) && $field_info['translatable']) {
        global $language;
        $langcode = $language->language;
      }
      else {
        $langcode = LANGUAGE_NONE;
      }
      foreach ($entity->{$field}[$langcode] as $key => $delta) {
        $val = field_view_value($this->entity_type, $entity, $field, $delta, array(), $langcode);
        $ret[] = $val['#markup'];
      }
      $ret = implode(', ', $ret);
      return $ret;
    }
  }
  return FALSE;
}