function nodeaccess_userreference_reduce_variable in Node access user reference 7.3
Reduce settings array to the bare minimum.
Parameters
$variable: The settings array.
Return value
The minimum array or FALSE if there is no array left to save.
2 calls to nodeaccess_userreference_reduce_variable()
- nodeaccess_userreference_field_update_instance in ./
nodeaccess_userreference.module - Implements hook_field_update_instance().
- nodeaccess_userreference_update_7306 in ./
nodeaccess_userreference.install - Reduce settings to essentials.
File
- ./
nodeaccess_userreference.module, line 540 - The Node access user reference module.
Code
function nodeaccess_userreference_reduce_variable($variable) {
// Filter the variable.
$variable = nodeaccess_userreference_recursive_filter($variable);
// Create a test array without the volatile keys and filter again.
$test = $variable;
unset($test['referenced_published']);
unset($test['author_published']);
unset($test['all_published']);
unset($test['unused']);
unset($test['priority']);
unset($test['field_type']);
$test = nodeaccess_userreference_recursive_filter($test);
// Remove major areas of the variable if they are empty in the test array.
foreach ($variable as $key => $value) {
if (is_array($value) && empty($test[$key])) {
unset($variable[$key]);
}
}
// If all of these are empty, then the variable can be considered empty.
if (empty($variable['referenced']) && empty($variable['create'])) {
return FALSE;
}
return $variable;
}