protected function PluginBase::setOptionDefaults

Fills up the options of the plugin with defaults.

Parameters

array $storage: An array which stores the actual option values of the plugin.

array $options: An array which describes the options of a plugin. Each element is an associative array containing:

  • default: The default value of one option
  • (optional) contains: An array which describes the available options under the key. If contains is set, the default will be ignored and assumed to be an empty array.
  • (optional) 'translatable': TRUE if it should be translated, else FALSE.
  • (optional) 'bool': TRUE if the value is boolean, else FALSE.
3 calls to PluginBase::setOptionDefaults()
DisplayPluginBase::initDisplay in drupal/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
PluginBase::init in drupal/core/modules/views/lib/Drupal/views/Plugin/views/PluginBase.php
Initialize the plugin.
TestHelperPlugin::testSetOptionDefaults in drupal/core/modules/views/lib/Drupal/views/Tests/TestHelperPlugin.php
Calls the protected method setOptionDefaults().

File

drupal/core/modules/views/lib/Drupal/views/Plugin/views/PluginBase.php, line 116
Definition of Drupal\views\Plugin\views\PluginBase.

Class

PluginBase

Namespace

Drupal\views\Plugin\views

Code

protected function setOptionDefaults(array &$storage, array $options) {
  foreach ($options as $option => $definition) {
    if (isset($definition['contains'])) {
      $storage[$option] = array();
      $this
        ->setOptionDefaults($storage[$option], $definition['contains']);
    }
    else {
      $storage[$option] = $definition['default'];
    }
  }
}