public function Field::init in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/views/src/Plugin/views/field/Field.php \Drupal\views\Plugin\views\field\Field::init()
Initialize the plugin.
Parameters
\Drupal\views\ViewExecutable $view: The view object.
\Drupal\views\Plugin\views\display\DisplayPluginBase $display: The display handler.
array $options: The options configured for this plugin.
Overrides FieldPluginBase::init
File
- core/
modules/ views/ src/ Plugin/ views/ field/ Field.php, line 176 - Contains \Drupal\views\Plugin\views\field\Field.
Class
- Field
- A field that displays entity field data.
Namespace
Drupal\views\Plugin\views\fieldCode
public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
parent::init($view, $display, $options);
$this->multiple = FALSE;
$this->limit_values = FALSE;
$field_definition = $this
->getFieldDefinition();
$cardinality = $field_definition
->getFieldStorageDefinition()
->getCardinality();
if ($field_definition
->getFieldStorageDefinition()
->isMultiple()) {
$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 ($this->options['delta_limit'] > 0 && $this->options['delta_limit'] != $cardinality || intval($this->options['delta_offset'])) {
$this->limit_values = TRUE;
}
}
}