function block_class_form_alter in Block Class 7
Same name and namespace in other branches
- 5 block_class.module \block_class_form_alter()
- 6 block_class.module \block_class_form_alter()
- 7.2 block_class.module \block_class_form_alter()
Implements hook_form_alter().
Alter block edit form to add configuration field.
File
- ./
block_class.module, line 79 - Enhanced control over the CSS Classes of any Block.
Code
function block_class_form_alter(&$form, &$form_state, $form_id) {
if (user_access('administer block classes') && $form_id == 'block_admin_configure' || $form_id == 'block_add_block_form') {
$block = new stdClass();
$block->module = $form['module']['#value'];
$block->delta = $form['delta']['#value'];
$css_class = block_class($block);
// More technical description for users with administer blocks permission.
$description = t('Customize the styling of this block by adding CSS classes. Separate multiple classes by spaces.');
$form['settings']['css_class'] = array(
'#type' => 'textfield',
'#title' => t('CSS class(es)'),
'#default_value' => $css_class,
'#description' => t('Separate classes with a space.'),
'#maxlength' => 255,
);
$form['#submit'][] = 'block_class_form_submit';
}
}