You are here

function antispam_block_configure in AntiSpam 7

Implements hook_block_configure().

File

./antispam.module, line 1665
Primary hook implementations for the Antispam module.

Code

function antispam_block_configure($delta = '') {
  $block_fields = _antispam_get_block_fields();
  if ($delta >= 0 && $delta < variable_get('antispam_blocks_counter', 1)) {
    $form = array();
    $form['description'] = array(
      '#type' => 'item',
      '#markup' => '<div class="description">' . t('These options allow to customize the look of this <em>antispam spam counter</em> block.') . '</div>',
    );
    $block_settings = variable_get('antispam_blocks_' . $delta, FALSE);
    foreach ($block_fields as $field_key => $field_info) {
      $field_name = 'antispam_blocks_' . $delta . '_' . $field_key;
      $form[$field_name] = array();
      foreach ($field_info as $key => $value) {
        $form[$field_name][$key] = $value;
      }
      if ($block_settings && isset($block_settings[$field_key])) {
        $form[$field_name]['#default_value'] = $block_settings[$field_key];
      }
    }
    return $form;
  }
}