'admin/settings/saveguard', 'title' => t('SaveGuard'), 'description' => t('Settings for SaveGaurd'), 'callback' => 'drupal_get_form', 'callback arguments' => array('saveguard_admin_settings'), 'access' => user_access('administer site configuration'), ); } return $items; } /** * Define a settings form. */ function saveguard_admin_settings() { $form['general'] = array( '#type' => 'fieldset', '#title' => t('General'), '#collapsible' => TRUE, ); $form['saveguard_message'] = array( '#type' => 'textfield', '#title' => t("Popup Message"), '#default_value' => variable_get('saveguard_message', NULL), ); // visibility match - added NPW visibility_api_form_configuration('saveguard', $form['general']); return system_settings_form($form); } /** * Implementation of hook_form_alter(). * Just add javascript to all forms. * * @param $form_id * name of the form being acted on * @param $form * array with form structure */ function saveguard_form_alter ($form_id, &$form) { // Visibility show - added NPW if (visibility_api_access('saveguard')){ drupal_add_js(drupal_get_path('module', 'saveguard') .'/saveguard.js'); static $done; if (!$done) { $settings['saveguard'] = array( 'msg' => variable_get('saveguard_message', NULL), ); drupal_add_js($settings, 'setting'); $done = TRUE; } } }