function Mapping::defineOptions
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' => $value['#default_value'] ?? $default,
    ];
    if (!empty($value['#toggle'])) {
      $options['mapping']['contains']["toggle_{$key}"] = [
        'default' => FALSE,
      ];
    }
  }
  return $options;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.