You are here

function closeblock_block_admin_configure in Close Block 6

Same name and namespace in other branches
  1. 7 includes/closeblock.form.inc \closeblock_block_admin_configure()

Add Closeblock settings to block settings form

_state

Parameters

$form:

2 calls to closeblock_block_admin_configure()
closeblock_form_block_add_block_form_alter in ./closeblock.module
Implements hook_form_FORM_ID_alter().
closeblock_form_block_admin_configure_alter in ./closeblock.module
Implements hook_form_FORM_ID_alter().

File

includes/closeblock.form.inc, line 98

Code

function closeblock_block_admin_configure(&$form, $form_state) {
  $settings = variable_get('closeblock_settings', array());
  $form['#submit'][] = 'closeblock_submit';
  $form['submit']['#weight'] = 11;
  $form['visibility']['closeblock'] = array(
    '#type' => 'fieldset',
    '#title' => t('Closeblock'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#weight' => 10,
    '#group' => 'visibility',
  );
  $params = array(
    'module' => $form['module']['#value'],
    'delta' => $form['delta']['#value'],
  );
  $block_id = theme('closeblock_block_id', $params);
  if (isset($settings[$block_id])) {
    $settings = $settings[$block_id];
  }
  else {
    $settings = array();
  }
  $settings = array_merge(closeblock_default_settings(), $settings, array());
  $form['visibility']['closeblock']['#collapsed'] = !$settings['closeblock_active'];
  $form['visibility']['closeblock']['closeblock_active'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use close button'),
    '#default_value' => $settings['closeblock_active'],
    '#description' => t('Advanced settings <a href="@link">here.</a>', array(
      '@link' => url('admin/build/themes/settings'),
    )),
  );
  $form['visibility']['closeblock']['closeblock_custom'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use custom settings'),
    '#default_value' => $settings['closeblock_custom'],
  );
  $form['visibility']['closeblock'] = array_merge($form['visibility']['closeblock'], closeblock_settings_elemnts($settings));
}