function block_class_form_alter in Block Class 7.2
Same name and namespace in other branches
- 5 block_class.module \block_class_form_alter()
- 6 block_class.module \block_class_form_alter()
- 7 block_class.module \block_class_form_alter()
Implements hook_form_alter().
Alter block edit form to add configuration field.
File
- ./
block_class.module, line 83 - Enhanced control over the CSS Classes of any Block.
Code
function block_class_form_alter(&$form, &$form_state, $form_id) {
// Form ids of modules with block creation pages also need to be checked.
if (user_access('administer block classes') && in_array($form_id, array(
'block_admin_configure',
'block_add_block_form',
'menu_block_add_block_form',
))) {
// Load statically cached block object used to display the form.
$block = block_load($form['module']['#value'], $form['delta']['#value']);
$form['settings']['css_class'] = array(
'#type' => 'textfield',
'#title' => t('CSS class(es)'),
'#default_value' => isset($block->css_class) ? $block->css_class : '',
'#description' => t('Customize the styling of this block by adding CSS classes. Separate multiple classes by spaces.'),
'#maxlength' => 255,
);
$form['#submit'][] = 'block_class_form_submit';
}
}