function EntityField::init
Same name in other branches
- 9 core/modules/views/src/Plugin/views/field/EntityField.php \Drupal\views\Plugin\views\field\EntityField::init()
- 8.9.x core/modules/views/src/Plugin/views/field/EntityField.php \Drupal\views\Plugin\views\field\EntityField::init()
- 10 core/modules/views/src/Plugin/views/field/EntityField.php \Drupal\views\Plugin\views\field\EntityField::init()
Overrides FieldPluginBase::init
File
-
core/
modules/ views/ src/ Plugin/ views/ field/ EntityField.php, line 213
Class
- EntityField
- 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;
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.