You are here

function mostpopular_blocks_admin_form_submit in Drupal Most Popular 7

1 string reference to 'mostpopular_blocks_admin_form_submit'
mostpopular_blocks_admin_form in ./mostpopular.blocks.inc
@file Provides an admin GUI for configuring most popular blocks.

File

./mostpopular.blocks.inc, line 183
Provides an admin GUI for configuring most popular blocks.

Code

function mostpopular_blocks_admin_form_submit(&$form, &$form_state) {
  if (!empty($form_state['confirm_delete'])) {
    $bid = $form_state['confirm_delete'];
    mostpopular_block_delete($bid);
    $form_state['redirect'] = 'admin/config/mostpopular/blocks';
    return;
  }
  foreach ($form_state['values']['blocks'] as $element) {
    $block = $element['block'];
    foreach ($element as $key => $val) {
      $block->{$key} = $val;
    }

    // Save the block definition.
    _mostpopular_save('block', $block);
  }
  drupal_set_message(t('Your Most Popular blocks were saved.'));
}