function views_object::_set_option_defaults

Same name in other branches
  1. 7.x-3.x includes/base.inc \views_object::_set_option_defaults()
1 call to views_object::_set_option_defaults()
views_object::set_default_options in includes/base.inc
Set default options. For backward compatibility, it sends the options array; this is a feature that will likely disappear at some point.

File

includes/base.inc, line 74

Class

views_object
Basic definition for many views objects

Code

function _set_option_defaults(&$storage, $options, $level = 0) {
    foreach ($options as $option => $definition) {
        if (isset($definition['contains']) && is_array($definition['contains'])) {
            $storage[$option] = array();
            $this->_set_option_defaults($storage[$option], $definition['contains'], $level++);
        }
        elseif (!empty($definition['translatable']) && !empty($definition['default'])) {
            $storage[$option] = t($definition['default']);
        }
        else {
            $storage[$option] = isset($definition['default']) ? $definition['default'] : NULL;
        }
    }
}