You are here

function yashare_admin_settings_validate in Yandex.Share 7.2

1 string reference to 'yashare_admin_settings_validate'
yashare_admin_settings in ./yashare.admin.inc
Returns settings form.

File

./yashare.admin.inc, line 260
Administration pages for the Yandex.Share module.

Code

function yashare_admin_settings_validate($form, &$form_state) {
  $values =& $form_state['values'];
  list($theme, $type) = explode('_', $values['yashare_theme_type']);
  $values['yashare_theme'] = $theme;
  $values['yashare_type'] = $type;
  unset($values['yashare_theme_type']);
  $services = yashare_services_list();

  // Remove weights so they are not saved as variables.
  foreach (array_keys($services) as $codename) {
    $block_services[$codename] = $values[$codename . '_block_weight'];
    $popup_services[$codename] = $values[$codename . '_popup_weight'];
    unset($values[$codename . '_block_weight']);
    unset($values[$codename . '_popup_weight']);
  }
  asort($block_services);
  asort($popup_services);
  $block_services_values = $values['yashare_block_services'];
  $popup_services_values = $values['yashare_popup_services'];
  unset($values['yashare_block_services']);
  unset($values['yashare_popup_services']);
  foreach (array_keys($block_services) as $codename) {
    $values['yashare_block_services'][$codename] = $block_services_values[$codename];
  }
  foreach (array_keys($popup_services) as $codename) {
    $values['yashare_popup_services'][$codename] = $popup_services_values[$codename];
  }
}