You are here

function popups_form_alter in Popups API (Ajax Dialogs) 5

Same name and namespace in other branches
  1. 6.2 popups.module \popups_form_alter()
  2. 6 popups.module \popups_form_alter()
  3. 7 popups.module \popups_form_alter()

File

./popups.module, line 167
popups.module

Code

function popups_form_alter($form_id, &$form) {

  // Add popup behavior to the form if requested.
  $popups = popups_get_popups();
  if (isset($popups[$form_id])) {
    popups_add_popups($popups[$form_id]);
  }

  // Alter the theme configuration pages, to add a per-theme-content selector.
  $theme = arg(4);
  if ($form_id == 'system_theme_settings' && $theme) {
    $form['popups'] = array(
      '#type' => 'fieldset',
      '#title' => t('Popup Settings'),
      '#weight' => -2,
    );
    $form['popups']['popups_content_selector'] = array(
      '#type' => 'textfield',
      '#title' => t('Content Selector'),
      '#default_value' => variable_get('popups_' . $theme . '_content_selector', 'div#content'),
      '#description' => t("jQuery selector to define the page's content area on this theme."),
    );
    $form['popups']['popups_theme'] = array(
      '#type' => 'hidden',
      '#value' => $theme,
    );

    //    $form['#submit'][] = 'popups_theme_settings_form_submit'; // D6 format.
    $form['#submit']['popups_theme_settings_form_submit'] = array();

    // D5 format.
  }
}