You are here

function synonyms_views_handler_field_synonyms::get_value in Synonyms 7

Get the value that's supposed to be rendered.

This api exists so that other modules can easy set the values of the field without having the need to change the render method as well.

Parameters

object $values: An object containing all retrieved values.

string $field: Optional name of the field where the value is stored.

Overrides views_handler_field::get_value

File

views/synonyms_views_handler_field_synonyms.inc, line 69
Definition of synonyms_handler_field_synonyms class.

Class

synonyms_views_handler_field_synonyms
Views field handler for displaying synonyms of an entity.

Code

function get_value($values, $field = NULL) {
  $property = $this->field;
  $wrapper = entity_metadata_wrapper($this->definition['synonyms entity type'], $values->synonyms_entity);
  $synonyms = $wrapper->{$property}
    ->value(array(
    'sanitize' => TRUE,
  ));
  if (empty($synonyms)) {
    $synonyms = '';
  }
  else {
    switch ($this->options['list']) {
      case 'ol':
      case 'ul':
        $synonyms = theme('item_list', array(
          'type' => $this->options['list'],
          'items' => $synonyms,
        ));
        break;
      case 'separator':
        $synonyms = implode($this->options['separator'], $synonyms);
        break;
    }
  }
  return $synonyms;
}