You are here

function advagg_find_all_changed_admin_values in Advanced CSS/JS Aggregation 7.2

Get form values that have changed.

Parameters

array $element: Form element or child element.

Return value

array An array of form names and the recommended value for that setting.

1 call to advagg_find_all_changed_admin_values()
advagg_set_admin_form_defaults_recommended in ./advagg.module
Save form defaults or recommended values.

File

./advagg.module, line 6795
Advanced CSS/JS aggregation module.

Code

function advagg_find_all_changed_admin_values(array &$element) {
  $results = array();
  $children = element_children($element);
  foreach ($children as $key) {
    $child = $element[$key];
    if (is_array($child)) {
      if (!empty($child['#type']) && !empty($child['#name']) && isset($child['#default_value']) && isset($child['#value'])) {
        if ($child['#type'] === 'checkboxes') {

          // Add in not selected by default values.
          $child['#value'] += array_diff_assoc($child['#default_value'], $child['#value']);
        }
        if ($child['#default_value'] != $child['#value']) {
          $results[$child['#name']] = array(
            $child['#value'],
            $child['#default_value'],
          );
        }
      }
      $results = array_merge($results, advagg_find_all_changed_admin_values($child));
    }
    unset($child);
  }
  return $results;
}