You are here

function blocktheme_update in Block Theme 6

Same name and namespace in other branches
  1. 8 blocktheme.module \blocktheme_update()
  2. 7 blocktheme.module \blocktheme_update()

Update an existing block after the block form has been submitted.

1 string reference to 'blocktheme_update'
blocktheme_form_block_admin_configure_alter in ./blocktheme.module
Form for updating a block.

File

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

Code

function blocktheme_update($form_id, &$form_state) {
  $var_name = $form_state['values']['module'] . '-' . $form_state['values']['delta'];
  $blocktheme = blocktheme_get();
  $blocktheme_vars = blocktheme_get_vars();
  if (!$form_state['values']['blocktheme']) {
    unset($blocktheme[$var_name]);
  }
  else {
    $blocktheme[$var_name] = $form_state['values']['blocktheme'];
  }
  if (!$form_state['values']['blocktheme_vars']) {
    unset($blocktheme_vars[$var_name]);
  }
  else {
    $blocktheme_vars[$var_name] = blocktheme_format_vars($form_state['values']['blocktheme_vars']);
  }
  blocktheme_set($blocktheme, $blocktheme_vars);
}