You are here

function responsive_share_buttons_settings_validate in Responsive Share Buttons 7

Validation callback for responsive_share_buttons_settings.

Sorts the networks by weight.

1 string reference to 'responsive_share_buttons_settings_validate'
responsive_share_buttons_settings in ./responsive_share_buttons.admin.inc
Settings form as implemented by hook_menu.

File

./responsive_share_buttons.admin.inc, line 55
Functionality for Responsive share buttons administration.

Code

function responsive_share_buttons_settings_validate(&$form, &$form_state) {
  $networks = variable_get('responsive_share_buttons', array());

  // Replace the input because the variable name and input name don't match.
  $values = $form_state['values']['responsive_share_buttons']['networks'];
  unset($form_state['values']['responsive_share_buttons']['networks']);
  foreach ($networks as $name => $network) {

    // Structure the data so it can be sorted.
    $form_state['values']['responsive_share_buttons'][$name] = array(
      'active' => $values[$name]['active'],
      'weight' => $values[$name]['weight'],
    );
  }
}