diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/PluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/PluginBase.php index 34c4f12ddc8ffa027079018ace53509dd24ef2c6..8bf057bc41d3c98246359bca8726965d77cab260 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/PluginBase.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/PluginBase.php @@ -99,17 +99,29 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o */ protected function defineOptions() { return array(); } - protected function setOptionDefaults(&$storage, $options, $level = 0) { + /** + * Fills up the options of the plugin with defaults. + * + * @param array $storage + * An array which stores the actual option values of the plugin. + * @param 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. + */ + protected function setOptionDefaults(array &$storage, array $options) { foreach ($options as $option => $definition) { - if (isset($definition['contains']) && is_array($definition['contains'])) { + if (isset($definition['contains'])) { $storage[$option] = array(); - $this->setOptionDefaults($storage[$option], $definition['contains'], $level++); - } - elseif (!empty($definition['translatable']) && !empty($definition['default'])) { - $storage[$option] = t($definition['default']); + $this->setOptionDefaults($storage[$option], $definition['contains']); } else { - $storage[$option] = isset($definition['default']) ? $definition['default'] : NULL; + $storage[$option] = $definition['default']; } } } diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/field/Boolean.php b/core/modules/views/lib/Drupal/views/Plugin/views/field/Boolean.php index 906265a07ef9a269e167a269edf004097be1e240..7a6fb95031e6aaa90ba77685037ae08605ef8544 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/field/Boolean.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/field/Boolean.php @@ -38,7 +38,7 @@ protected function defineOptions() { $options['type'] = array('default' => 'yes-no'); $options['type_custom_true'] = array('default' => '', 'translatable' => TRUE); $options['type_custom_false'] = array('default' => '', 'translatable' => TRUE); - $options['not'] = array('definition bool' => 'reverse'); + $options['not'] = array('default' => FALSE, 'bool' => TRUE); return $options; } diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/row/RssFields.php b/core/modules/views/lib/Drupal/views/Plugin/views/row/RssFields.php index b2348d9c1ed7e87a52130084c9a840a5efd8670b..6baf71651172c88f582ad5c6c01f3ecd6295ef13 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/row/RssFields.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/row/RssFields.php @@ -37,8 +37,8 @@ protected function defineOptions() { $options['description_field'] = array('default' => ''); $options['creator_field'] = array('default' => ''); $options['date_field'] = array('default' => ''); - $options['guid_field_options']['guid_field'] = array('default' => ''); - $options['guid_field_options']['guid_field_is_permalink'] = array('default' => TRUE, 'bool' => TRUE); + $options['guid_field_options']['contains']['guid_field'] = array('default' => ''); + $options['guid_field_options']['contains']['guid_field_is_permalink'] = array('default' => TRUE, 'bool' => TRUE); return $options; }