You are here

public function views_handler_field_field::init in Views (for Drupal 7) 7.3

Init the handler with necessary data.

Parameters

view $view: The $view object this handler is attached to.

array $options: The item from the database; the actual contents of this will vary based upon the type of handler.

Overrides views_handler_field::init

File

modules/field/views_handler_field_field.inc, line 87
Definition of views_handler_field_field.

Class

views_handler_field_field
A field that displays fieldapi fields.

Code

public function init(&$view, &$options) {
  parent::init($view, $options);
  $this->field_info = $field = field_info_field($this->definition['field_name']);
  $this->multiple = FALSE;
  $this->limit_values = FALSE;
  if ($field['cardinality'] > 1 || $field['cardinality'] == FIELD_CARDINALITY_UNLIMITED) {
    $this->multiple = TRUE;

    // If "Display all values in the same row" is FALSE, then we always limit
    // in order to show a single unique value per row.
    if (!$this->options['group_rows']) {
      $this->limit_values = TRUE;
    }

    // If "First and last only" is chosen, limit the values.
    if (!empty($this->options['delta_first_last'])) {
      $this->limit_values = TRUE;
    }

    // Otherwise, we only limit values if the user hasn't selected "all", 0,
    // or the value matching field cardinality.
    if (intval($this->options['delta_limit']) && $this->options['delta_limit'] != $field['cardinality'] || intval($this->options['delta_offset'])) {
      $this->limit_values = TRUE;
    }
  }

  // Convert old style entity id group column to new format.
  // @todo Remove for next major version.
  if ($this->options['group_column'] == 'entity id') {
    $this->options['group_column'] = 'entity_id';
  }
}