You are here

function beautytips_manager_custom_tips_form_submit in BeautyTips 7.2

Submission callback for beautytips manager custom tips form.

1 string reference to 'beautytips_manager_custom_tips_form_submit'
beautytips_manager_custom_tips_form in ./beautytips_manager.admin.inc
Form for configuring custom beautytips.

File

./beautytips_manager.admin.inc, line 286
Administration pages and forms for beautytips manager.

Code

function beautytips_manager_custom_tips_form_submit($form, &$form_state) {
  $tip = $form_state['values']['tip'];
  $positions = [];
  foreach ($tip['positions'] as $position => $order) {
    if ($order !== '') {
      while (isset($positions[$order])) {
        $order++;
      }
      $positions[$order] = $position;
    }
  }
  ksort($positions);
  $tip['positions'] = count($positions) ? implode(',', $positions) : '';
  beautytips_manager_save_custom_tip($tip);
  cache_clear_all('beautytips:beautytips-ui-custom-tips', 'cache');
  $form_state['redirect'] = 'admin/config/user-interface/beautytips/custom-tips';
}