You are here

function popup_block_form_alter in Popup 6.x

Same name and namespace in other branches
  1. 8 modules/popup_block/popup_block.module \popup_block_form_alter()
  2. 7 modules/popup_block/popup_block.module \popup_block_form_alter()
  3. 7.x modules/popup_block/popup_block.module \popup_block_form_alter()

Implementation of hook_form_alter Adds UI settings to block configuration

File

modules/popup_block/popup_block.module, line 9

Code

function popup_block_form_alter(&$form, $form_state, $form_id) {
  if ($form_id == 'block_admin_configure' && $form['module']['#value'] != 'popup_menu') {
    module_load_include('inc', 'popup_ui', 'includes/popup_ui.admin');
    $settings = _popup_block_settings();
    $block_settings = $settings[$form['module']['#value'] . ':' . $form['delta']['#value']];
    $format_options = array_keys(_popup_ui_formatter_settings());
    array_unshift($format_options, 'Default');
    $display_format_options = array_combine($format_options, $format_options);
    $form['popup'] = array(
      '#type' => 'fieldset',
      '#title' => t('Block popup settings'),
      '#collapsible' => 1,
      'popup-block' => array(
        '#default_value' => $block_settings['active'],
        '#description' => t('This will render the block with the body initially invisible. When a user hovers over or clicks on the title, the body is displayed.'),
        '#title' => t('Display this block as a popup'),
        '#type' => 'checkbox',
      ),
      'popup-block-format' => array(
        '#default_value' => $block_settings['format'],
        '#title' => 'Display format',
        '#type' => 'select',
        '#options' => $display_format_options,
        '#description' => t('Select the format in which to display popups. You may manage popup formats !here.', array(
          '!here' => l('here', 'admin/settings/popup/formats'),
        )),
      ),
    );
    $form['submit']['#weight'] = 10;
    $form['#submit'][] = 'popup_block_form_submit';
  }
}