function better_exposed_filters_exposed_form_plugin::unpack_options in Better Exposed Filters 7.3
Unpack options over our existing defaults, drilling down into arrays so that defaults don't get totally blown away.
Overrides views_object::unpack_options
1 call to better_exposed_filters_exposed_form_plugin::unpack_options()
- better_exposed_filters_exposed_form_plugin::init in ./
better_exposed_filters_exposed_form_plugin.inc - Initialize the plugin.
File
- ./
better_exposed_filters_exposed_form_plugin.inc, line 2196 - Provides an Better Exposed Filters exposed form plugin for View 3.x.
Class
- better_exposed_filters_exposed_form_plugin
- Better exposed filter form plugin class.
Code
function unpack_options(&$storage, $options, $definition = NULL, $all = TRUE, $check = TRUE, $localization_keys = array()) {
parent::unpack_options($storage, $options, $definition, $all, $check, $localization_keys);
// Override the values.
foreach ($this->localization_keys as $key => $parents) {
$parent = end($parents);
$value = isset($options[$parent]) ? $options[$parent] : NULL;
// Don't localize strings during editing. When editing, we need to work
// with the original data, not the translated version.
if (empty($this->view->editing) && !empty($value)) {
if (!empty($this->view) && $this->view
->is_translatable()) {
// Allow other modules to make changes to the string before it's
// sent for translation.
// The $keys array is built from the bef form array structure.
$format = NULL;
$translation_data = array(
'value' => $value,
'format' => $format,
'keys' => $parents,
);
$storage[$parent] = $this->view->localization_plugin
->translate($translation_data);
}
else {
$storage[$parent] = t($value);
}
}
elseif (!empty($value)) {
$storage[$parent] = $value;
}
}
}