function block_class_styles_admin_settings in Block Class Styles 7
Same name and namespace in other branches
- 7.2 block_class_styles.admin.inc \block_class_styles_admin_settings()
Form builder. Configure my_module.
See also
Related topics
1 string reference to 'block_class_styles_admin_settings'
- block_class_styles_menu in ./
block_class_styles.module - Implements hook_menu().
File
- ./
block_class_styles.admin.inc, line 17 - Administration page callbacks for the block_class_styles module.
Code
function block_class_styles_admin_settings() {
$form = array();
$options = array(
NULL => '-default-',
);
foreach (filter_formats() as $format) {
$options[$format->format] = $format->name;
}
$form['block_class_styles_title_format'] = array(
'#type' => 'select',
'#title' => t('Block Titles Format'),
'#description' => t('In Drupal core, custom block titles must be plain text. You may override this by selecting a global format for block titles. This affects the title you enter when editing a block, not the titles automatically generated by modules.'),
'#default_value' => variable_get('block_class_styles_title_format', BLOCK_CLASS_STYLES_TITLE_FORMAT),
'#options' => $options,
);
$default = $presets = block_class_styles_info();
$temp = '';
foreach ($default as $key => $value) {
$temp .= "{$key}|{$value}\n";
}
$default = $temp;
$form['block_class_styles_presets'] = array(
'#type' => 'textarea',
'#title' => t('Style Definitions'),
'#description' => t('Enter class/style presets one per line like this: <code>css-class|Style Name</code>. You may combine multiple classes in one style by separating classes with a space, e.g. <code>some-class another-class|Combo Style</code>'),
'#default_value' => $default,
'#rows' => 10,
'#resizable' => TRUE,
);
$options = array();
foreach ($presets as $css => $style) {
$tpl = str_replace('_', '-', _block_class_styles_theme_hook_suggestion($style)) . '.tpl.php';
$options[$css] = $style . " <code>({$tpl})</code>";
}
if ($options) {
$form['block_class_styles_delete'] = array(
'#type' => 'checkboxes',
'#title' => t("To Delete a Style Check It's Box (and click Save configuration)"),
'#options' => $options,
);
}
// @todo Find a way to make this work; it is incompatible with the storage mechanism of block_class
//$form['block_class_styles_allow_multiple'] = array(
// '#type' => 'checkboxes',
// '#title' => t('Single or Multiple?'),
// '#options' => array(TRUE => t('Allow more than one style definition per block?')),
// '#default_value' => variable_get('block_class_styles_allow_multiple', BLOCK_CLASS_STYLES_ALLOW_MULTIPLE),
//);
$form['form_text_overrides'] = array(
'#type' => 'fieldset',
'#title' => t('Block Edit Form Settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['form_text_overrides']['block_class_styles_fs_title'] = array(
'#type' => 'textfield',
'#title' => t('Fieldset Title'),
'#default_value' => variable_get('block_class_styles_fs_title', BLOCK_CLASS_STYLES_FS_TITLE),
);
$form['form_text_overrides']['block_class_styles_fs_description'] = array(
'#type' => 'textarea',
'#rows' => 2,
'#title' => t('Fieldset Instructions'),
'#default_value' => variable_get('block_class_styles_fs_description', BLOCK_CLASS_STYLES_FS_DESCRIPTION),
);
$form['form_text_overrides']['block_class_styles_title'] = array(
'#type' => 'textfield',
'#title' => t('Selector Title'),
'#default_value' => variable_get('block_class_styles_title', BLOCK_CLASS_STYLES_TITLE),
);
$form['form_text_overrides']['block_class_styles_description'] = array(
'#type' => 'textarea',
'#rows' => 2,
'#title' => t('Selector Description'),
'#description' => t('Optional text to appear below the selector on the block edit pages.'),
'#default_value' => variable_get('block_class_styles_description', BLOCK_CLASS_STYLES_DESCRIPTION),
);
$form['form_text_overrides']['block_class_styles_form_weight'] = array(
'#type' => 'weight',
'#title' => t('Position in Form'),
'#description' => t('To position the fieldset higher in the form, choose a lower number.'),
'#default_value' => variable_get('block_class_styles_form_weight', 0),
'#delta' => 20,
);
//$form['form_text_overrides']['block_class_styles_hide_classes'] = array(
// '#type' => 'checkbox',
// '#title' => t('Check this box to hide the <strong>CSS class(es)</strong> textfield created by the Block Class module.'),
// '#default_value' => variable_get('block_class_styles_hide_classes', BLOCK_CLASS_STYLES_HIDE_CLASSES),
//);
$form['form_text_overrides']['block_class_styles_form_collapsed'] = array(
'#type' => 'checkbox',
'#title' => t('Check to open the fieldset by default'),
'#default_value' => variable_get('block_class_styles_form_collapsed', FALSE),
);
$form['#validate'][] = 'block_class_styles_admin_settings_validate';
return system_settings_form($form);
}