You are here

protected function Mapping::defineOptions in Views (for Drupal 7) 8.3

Overrides Drupal\views\Plugin\views\style\StylePluginBase::defineOptions().

Overrides StylePluginBase::defineOptions

File

lib/Drupal/views/Plugin/views/style/Mapping.php, line 50
Definition of Drupal\views\Plugin\views\style\Mapping.

Class

Mapping
Allows fields to be mapped to specific use cases.

Namespace

Drupal\views\Plugin\views\style

Code

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']) ? array() : '';
    $options['mapping']['contains'][$key] = array(
      'default' => isset($value['#default_value']) ? $value['#default_value'] : $default,
    );
    if (!empty($value['#toggle'])) {
      $options['mapping']['contains']["toggle_{$key}"] = array(
        'default' => FALSE,
        'bool' => TRUE,
      );
    }
  }
  return $options;
}