You are here

protected function Mapping::defineOptions in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 52
Contains \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,
      );
    }
  }
  return $options;
}