diff --git a/menu_block.admin.inc b/menu_block.admin.inc
index eda4fd6..dfb30d8 100644
--- a/menu_block.admin.inc
+++ b/menu_block.admin.inc
@@ -294,6 +294,12 @@ function menu_block_configure_form($form, &$form_state) {
'#description' => t('The preferred menus used by <the menu selected by the page> can be customized on the Menu block settings page.', array('!url' => url('admin/config/user-interface/menu-block'))),
'#attributes' => array('class' => array('menu-block-menu-name')),
);
+ $form['class_name'] = array(
+ '#type' => 'textfield',
+ '#default_value' => $config['class_name'],
+ '#title' => t('Additional CSS class name'),
+ '#description' => t('Optionally assign a CSS class name in addition to menu-block-!delta.', array('!delta' => $form_state['values']['delta'])),
+ );
$form['level'] = array(
'#type' => 'select',
'#title' => t('Starting level'),
@@ -395,7 +401,7 @@ function menu_block_configure_form($form, &$form_state) {
$form['menu-block-wrapper-close'] = array('#markup' => '');
// Set visibility of advanced options.
- foreach (array('title_link', 'follow', 'depth_relative', 'follow_parent', 'expanded', 'sort', 'parent') as $key) {
+ foreach (array('title_link', 'follow', 'depth_relative', 'follow_parent', 'expanded', 'sort', 'parent', 'class_name') as $key) {
$form[$key]['#states']['visible'][':input[name=display_options]'] = array('value' => 'advanced');
}
if ($config['title_link'] || $follow || $config['expanded'] || $config['sort'] || $config['parent_mlid']) {
@@ -440,6 +446,7 @@ function _menu_block_block_save($delta = '', $edit = array()) {
if (empty($config['exported_to_code'])) {
variable_set("menu_block_{$delta}_title_link", $edit['title_link']);
variable_set("menu_block_{$delta}_admin_title", $edit['admin_title']);
+ variable_set("menu_block_{$delta}_class_name", $edit['class_name']);
variable_set("menu_block_{$delta}_parent", $edit['parent']);
variable_set("menu_block_{$delta}_level", $edit['level']);
variable_set("menu_block_{$delta}_follow", $edit['follow']);
diff --git a/menu_block.module b/menu_block.module
index a5bf396..bcee826 100644
--- a/menu_block.module
+++ b/menu_block.module
@@ -191,6 +191,10 @@ function template_preprocess_menu_block_wrapper(&$variables) {
$variables['classes_array'][] = 'menu-name-' . $variables['config']['menu_name'];
$variables['classes_array'][] = 'parent-mlid-' . menu_block_clean_css_identifier($variables['config']['parent_mlid']);
$variables['classes_array'][] = 'menu-level-' . $variables['config']['level'];
+ $classes = explode(' ', $variables['config']['class_name']);
+ foreach ($classes as $class) {
+ $variables['classes_array'][] = drupal_html_class($class);
+ }
}
/**
@@ -245,6 +249,7 @@ function menu_block_default_config() {
'depth_relative' => 0,
'expanded' => 0,
'sort' => 0,
+ 'class_name' => '',
);
}
@@ -327,6 +332,7 @@ function menu_block_get_config($delta = NULL) {
}
$config['delta'] = $delta;
+ drupal_alter('menu_block_config', $config, $delta);
$configs[$delta] = $config;
}