You are here

function popups_form_alter in Popups API (Ajax Dialogs) 6

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

Implementation of hook_form_alter().

Look at the form_id and see if popup behavior has been requested for any links in this form.

Parameters

form_array $form:

array $form_state:

str $form_id: :

File

./popups.module, line 119
This module provides a hook_popups for links to be openned in an Ajax Popup Dialog.

Code

function popups_form_alter(&$form, $form_state, $form_id) {

  // 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', _popups_default_content_selector()),
      '#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';
  }
}