function mongodb_block_ui_admin_configure_submit in MongoDB 7
Form submission handler for block_admin_configure().
Parameters
array $form: The form.
array &$form_state: The referenced form state.
Throws
\MongoConnectionException
\MongoCursorException
\MongoCursorTimeoutException
\MongoException
\MongoWriteConcernException
File
- mongodb_block_ui/
mongodb_block_ui.admin.inc, line 381 - Admin page callbacks for the mongodb_block_ui module.
Code
function mongodb_block_ui_admin_configure_submit(array $form, array &$form_state) {
// FIXME: this stores the visibility settings, the title of the block etc.
$collection = mongodb_collection('block_customized', $form['#theme_key']);
$id = array(
'module' => $form_state['values']['module'],
'delta' => $form_state['values']['delta'],
);
$customized = array(
'pages' => _mongodb_block_ui_admin_pages($form_state['values']['pages'], array(
'%',
)),
'pages_exclude' => _mongodb_block_ui_admin_pages($form_state['values']['pages_exclude'], array()),
'title' => $form_state['values']['title'],
);
// This way region and weight is preserved.
$collection
->update(array(
'_id' => $id,
), array(
'$set' => $customized,
), array(
'upsert' => TRUE,
) + mongodb_default_write_options());
// Ensure that custom blocks have their settings saved.
// @todo: this should probably be done via hook_block_configure().
if ($form_state['values']['module'] == 'mongodb_block_ui') {
$block = array(
'_id' => $form_state['values']['delta'],
'body' => $form_state['values']['body'],
'info' => $form_state['values']['info'],
'title' => $form_state['values']['title'],
);
mongodb_collection('block_custom')
->save($block, mongodb_default_write_options());
}
module_invoke($form_state['values']['module'], 'block_save', $form_state['values']['delta'], $form_state['values']);
drupal_set_message(t('The block configuration has been saved.'));
cache_clear_all();
$form_state['redirect'] = 'admin/structure/mongodb_block/manage/' . $form_state['values']['module'] . '/' . $form_state['values']['delta'];
}