function block_class_form_alter in Block Class 6
Same name and namespace in other branches
- 5 block_class.module \block_class_form_alter()
- 7.2 block_class.module \block_class_form_alter()
- 7 block_class.module \block_class_form_alter()
Implements hook_form_FORM_ID_alter().
In this case FORM_ID is block_admin_configure. Adds the block_class controls for block configurations.
File
- ./
block_class.module, line 85 - Provides core logic for adding block classes.
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'];
$attributes = block_class_attributes($block);
// More technical description for users with administer blocks permission.
$description = t('Customize the styling of this block by adding CSS classes. You can add multiple classes.');
if (user_access('administer blocks')) {
$description .= ' ' . t("IMPORTANT: You must add <code><?php print {$block_classes}; ?></code> to your theme's block.tpl.php file to make the classes appear. See the module\\'s README.txt for more details.");
}
$form['block_class'] = array(
'#type' => 'fieldset',
'#title' => t('Block Class settings'),
'#collapsible' => TRUE,
'#weight' => 0,
'#description' => $description,
);
$form['block_class']['css_class'] = array(
'#type' => 'textfield',
'#title' => t('CSS class(es)'),
'#default_value' => $attributes->css_class,
'#description' => t('Separate classes with a space.'),
'#maxlength' => 255,
);
$form['#submit'][] = 'block_class_form_submit';
}
}