You are here

function blocktheme_form_block_admin_configure_alter in Block Theme 7

Same name and namespace in other branches
  1. 6 blocktheme.module \blocktheme_form_block_admin_configure_alter()

Form for updating a block.

File

./blocktheme.module, line 92
Provides a configuration option to select custom themes for blocks

Code

function blocktheme_form_block_admin_configure_alter(&$form, &$form_state) {
  $module = $form['module']['#value'];
  $delta = $form['delta']['#value'];
  $var_name = $module . '-' . $delta;
  $options = blocktheme_get_blockthemes();
  $blocktheme = blocktheme_get();
  $blocktheme_vars = blocktheme_get_vars();
  $form['settings']['#weight'] = -2;
  $form['regions']['#weight'] = -1;
  $form['custom_block_theme'] = array(
    '#type' => 'fieldset',
    '#title' => t('Block Theme'),
    '#weight' => 0,
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['custom_block_theme']['blocktheme'] = array(
    '#type' => 'select',
    '#title' => t('Custom theme'),
    '#default_value' => isset($blocktheme[$var_name]) ? $blocktheme[$var_name] : '',
    '#options' => $options,
  );
  $form['custom_block_theme']['blocktheme_vars'] = array(
    '#type' => 'textarea',
    '#default_value' => isset($blocktheme_vars[$var_name]) ? blocktheme_format_vars_admin($blocktheme_vars[$var_name]) : '',
    '#title' => t('Custom block variables'),
    '#description' => t('Enter one entry per line, in the format: <em>variable_name|variable_content</em>.'),
    '#wysiwyg' => FALSE,
  );
  $form['#submit'][] = 'blocktheme_update';
}