protected function Field::defineOptions in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/modules/views/src/Plugin/views/field/Field.php \Drupal\views\Plugin\views\field\Field::defineOptions()
Information about options for all kinds of purposes will be held here.
'option_name' => array(
- 'default' => default value,
- 'contains' => (optional) array of items this contains, with its own
defaults, etc. If contains is set, the default will be ignored and
assumed to be array().
),
Return value
array Returns the options of this handler/plugin.
Overrides FieldPluginBase::defineOptions
1 call to Field::defineOptions()
- TermName::defineOptions in core/
modules/ taxonomy/ src/ Plugin/ views/ field/ TermName.php - Information about options for all kinds of purposes will be held here.
1 method overrides Field::defineOptions()
- TermName::defineOptions in core/
modules/ taxonomy/ src/ Plugin/ views/ field/ TermName.php - Information about options for all kinds of purposes will be held here.
File
- core/
modules/ views/ src/ Plugin/ views/ field/ Field.php, line 340 - Contains \Drupal\views\Plugin\views\field\Field.
Class
- Field
- A field that displays entity field data.
Namespace
Drupal\views\Plugin\views\fieldCode
protected function defineOptions() {
$options = parent::defineOptions();
$field_storage_definition = $this
->getFieldStorageDefinition();
$field_type = $this->fieldTypePluginManager
->getDefinition($field_storage_definition
->getType());
$column_names = array_keys($field_storage_definition
->getColumns());
$default_column = '';
// Try to determine a sensible default.
if (count($column_names) == 1) {
$default_column = $column_names[0];
}
elseif (in_array('value', $column_names)) {
$default_column = 'value';
}
// If the field has a "value" column, we probably need that one.
$options['click_sort_column'] = array(
'default' => $default_column,
);
if (isset($this->definition['default_formatter'])) {
$options['type'] = [
'default' => $this->definition['default_formatter'],
];
}
elseif (isset($field_type['default_formatter'])) {
$options['type'] = [
'default' => $field_type['default_formatter'],
];
}
else {
$options['type'] = [
'default' => '',
];
}
$options['settings'] = array(
'default' => isset($this->definition['default_formatter_settings']) ? $this->definition['default_formatter_settings'] : [],
);
$options['group_column'] = array(
'default' => $default_column,
);
$options['group_columns'] = array(
'default' => array(),
);
// Options used for multiple value fields.
$options['group_rows'] = array(
'default' => TRUE,
);
// If we know the exact number of allowed values, then that can be
// the default. Otherwise, default to 'all'.
$options['delta_limit'] = array(
'default' => $field_storage_definition
->getCardinality() > 1 ? $field_storage_definition
->getCardinality() : 0,
);
$options['delta_offset'] = array(
'default' => 0,
);
$options['delta_reversed'] = array(
'default' => FALSE,
);
$options['delta_first_last'] = array(
'default' => FALSE,
);
$options['multi_type'] = array(
'default' => 'separator',
);
$options['separator'] = array(
'default' => ', ',
);
$options['field_api_classes'] = array(
'default' => FALSE,
);
return $options;
}