function block_class_form_submit in Block Class 7
Same name and namespace in other branches
- 6.2 block_class.module \block_class_form_submit()
- 6 block_class.module \block_class_form_submit()
- 7.2 block_class.module \block_class_form_submit()
Helper function: additional submit callback for block configuration pages.
Save supplied CSS classes.
1 string reference to 'block_class_form_submit'
- block_class_form_alter in ./
block_class.module - Implements hook_form_alter().
File
- ./
block_class.module, line 106 - Enhanced control over the CSS Classes of any Block.
Code
function block_class_form_submit($form, &$form_state) {
if ($form_state['values']['form_id'] == 'block_admin_configure' || $form_state['values']['form_id'] == 'block_add_block_form') {
if (isset($form_state['values']['css_class']) && user_access('administer blocks')) {
$module = $form_state['values']['module'];
$delta = $form_state['values']['delta'];
$class = $form_state['values']['css_class'];
db_delete('block_class')
->condition('module', $module)
->condition('delta', $delta)
->execute();
if (!empty($class)) {
$id = db_insert('block_class')
->fields(array(
'module' => $module,
'delta' => $delta,
'css_class' => $class,
))
->execute();
}
}
}
}