protected function Mapping::defineOptions in Drupal 8
Same name and namespace in other branches
- 9 core/modules/views/src/Plugin/views/style/Mapping.php \Drupal\views\Plugin\views\style\Mapping::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 StylePluginBase::defineOptions
File
- core/
modules/ views/ src/ Plugin/ views/ style/ Mapping.php, line 47
Class
- Mapping
- Allows fields to be mapped to specific use cases.
Namespace
Drupal\views\Plugin\views\styleCode
protected function defineOptions() {
$options = parent::defineOptions();
// Parse the mapping and add a default for each.
foreach ($this
->defineMapping() as $key => $value) {
$default = !empty($value['#multiple']) ? [] : '';
$options['mapping']['contains'][$key] = [
'default' => isset($value['#default_value']) ? $value['#default_value'] : $default,
];
if (!empty($value['#toggle'])) {
$options['mapping']['contains']["toggle_{$key}"] = [
'default' => FALSE,
];
}
}
return $options;
}