You are here

function collapsiblock_form_block_admin_configure_alter in Collapsiblock 7.2

Implements hook_form_alter().

File

./collapsiblock.module, line 101
Make blocks collapsible.

Code

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

  // Load statically cached block object used to display the form.
  $block = block_load($form['module']['#value'], $form['delta']['#value']);

  //$settings = variable_get('collapsiblock_settings', array());
  $form['#submit'][] = 'collapsiblock_submit';
  $form['collapsiblock'] = array(
    '#type' => 'fieldset',
    '#title' => t('Collapsible'),
    '#collapsible' => TRUE,
    '#weight' => -5,
  );

  // Add the global default to the list of options for the per-block setting.
  $options = unserialize(COLLAPSIBLOCK_ACTION_OPTIONS);
  $default = variable_get('collapsiblock_default_state', 1);
  $default = $options[$default];
  $options = array(
    0 => 'Global default, currently set to: ' . $default,
  ) + $options;
  $form['collapsiblock']['collapsiblock_action'] = array(
    '#type' => 'radios',
    '#title' => t('Block collapse behavior'),
    '#options' => $options,
    '#default_value' => isset($block->collapsiblock_action) ? $block->collapsiblock_action : 0,
  );
}