You are here

function tipsy_admin_submit in Tipsy 7

Implementation of form submit function for the admin form.

1 string reference to 'tipsy_admin_submit'
tipsy_admin in ./tipsy.admin.inc
Implementation of tipsy admin form.

File

./tipsy.admin.inc, line 292

Code

function tipsy_admin_submit($form, &$form_values) {
  $settings = array();
  $drupal_forms = $form_values['values']['wrapper'];
  $settings['drupal_forms'] = array(
    'forms' => $form_values['values']['forms'],
    'options' => array(
      'fade' => $drupal_forms['options']['fade'],
      'gravity' => $drupal_forms['options']['gravity'],
      'delayIn' => trim($drupal_forms['options']['delayIn']),
      'delayOut' => trim($drupal_forms['options']['delayOut']),
      'trigger' => $drupal_forms['options']['trigger'],
      'opacity' => trim($drupal_forms['options']['opacity']),
      'offset' => trim($drupal_forms['options']['offset']),
    ),
  );
  foreach ($form_values['values']['rules'] as $delta => $rule) {
    if (trim($rule['selector']) != '') {
      $settings['custom_selectors'][] = array(
        'selector' => trim($rule['selector']),
        'options' => array(
          'fade' => $rule['options']['fade'],
          'gravity' => $rule['options']['gravity'],
          'trigger' => $rule['options']['trigger'],
          'delayIn' => trim($rule['options']['delayIn']),
          'delayOut' => trim($rule['options']['delayOut']),
          'opacity' => trim($rule['options']['opacity']),
          'offset' => trim($rule['options']['offset']),
          'html' => $rule['options']['html'],
          'tooltip_content' => array(
            'source' => $rule['options']['tooltip_content']['source'],
            'selector' => trim($rule['options']['tooltip_content']['selector']),
          ),
        ),
      );
    }
  }
  variable_set('tipsy', $settings);
  drupal_set_message(t('Configuration saved'));
}