public function Field::init in Views (for Drupal 7) 8.3
Overrides Drupal\views\Plugin\views\HandlerBase::init().
Overrides FieldPluginBase::init
File
- lib/
Views/ field/ Plugin/ views/ field/ Field.php, line 69 - Definition of Views\field\Plugin\views\field\Field.
Class
- Field
- A field that displays fieldapi fields.
Namespace
Views\field\Plugin\views\fieldCode
public function init(ViewExecutable $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;
}
}
}