Skip to content

Commit

Permalink
Updating Menu Block to 7.x-2.8
Browse files Browse the repository at this point in the history
  • Loading branch information
mwanberg committed Dec 4, 2018
1 parent e314248 commit 6f3dc0b
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ label#item-label {
border: 1px solid #666;
color: #666;
font-weight: bold;
background-image: url(menu-block-background-display-options.png);
background-image: url(display-options-background.png);
background-position: left top;
background-repeat: no-repeat;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Drupal.behaviors.menu_block = {
}
});

// Syncronize the display of menu and parent item selects.
// Synchronize the display of menu and parent item selects.
$('.menu-block-parent-mlid', context).change( function() {
var menuItem = $(this).val().split(':');
$('.menu-block-menu-name').val(menuItem[0]);
Expand Down
17 changes: 13 additions & 4 deletions sites/all/modules/contrib/menu_block/menu_block.admin.inc
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,8 @@ function menu_block_configure_form($form, &$form_state) {
}

// Build the standard form.
$form['#attached']['js'][] = drupal_get_path('module', 'menu_block') . '/menu-block.js';
$form['#attached']['css'][] = drupal_get_path('module', 'menu_block') . '/menu-block.admin.css';
$form['#attached']['js'][] = drupal_get_path('module', 'menu_block') . '/js/menu-block.js';
$form['#attached']['css'][] = drupal_get_path('module', 'menu_block') . '/css/menu-block.admin.css';
$form['#attached']['library'][] = array('system', 'ui.button');

$form['menu-block-wrapper-start'] = array(
Expand Down Expand Up @@ -279,6 +279,12 @@ function menu_block_configure_form($form, &$form_state) {
),
);
}
$form['display_empty'] = array(
'#type' => 'checkbox',
'#title' => t('Always display title'),
'#description' => t('Display the block with its title even if the block content is empty.'),
'#default_value' => $config['display_empty'],
);
$form['admin_title'] = array(
'#type' => 'textfield',
'#default_value' => $config['admin_title'],
Expand Down Expand Up @@ -395,10 +401,12 @@ function menu_block_configure_form($form, &$form_state) {
$form['menu-block-wrapper-close'] = array('#markup' => '</div>');

// Set visibility of advanced options.
foreach (array('title_link', 'follow', 'depth_relative', 'follow_parent', 'expanded', 'sort', 'parent') as $key) {
foreach (array('title_link', 'display_empty', 'follow', 'depth_relative', 'follow_parent', 'expanded', 'sort', 'parent') 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']) {
// depth_relative and follow_parent aren't listed below because they require
// $follow to be true.
if ($config['title_link'] || $config['display_empty'] || $follow || $config['expanded'] || $config['sort'] || $config['parent_mlid']) {
$form['display_options']['#default_value'] = 'advanced';
}

Expand Down Expand Up @@ -443,6 +451,7 @@ function _menu_block_block_save($delta = '', $edit = array()) {
variable_set("menu_block_{$delta}_parent", $edit['parent']);
variable_set("menu_block_{$delta}_level", $edit['level']);
variable_set("menu_block_{$delta}_follow", $edit['follow']);
variable_set("menu_block_{$delta}_display_empty", $edit['display_empty']);
variable_set("menu_block_{$delta}_depth", $edit['depth']);
variable_set("menu_block_{$delta}_depth_relative", $edit['depth_relative']);
variable_set("menu_block_{$delta}_expanded", $edit['expanded']);
Expand Down
7 changes: 3 additions & 4 deletions sites/all/modules/contrib/menu_block/menu_block.info
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ dependencies[] = menu (>7.11)

configure = admin/config/user-interface/menu-block

; Information added by Drupal.org packaging script on 2015-06-30
version = "7.x-2.7"
; Information added by Drupal.org packaging script on 2018-12-04
version = "7.x-2.8"
core = "7.x"
project = "menu_block"
datestamp = "1435676232"

datestamp = "1543950483"
22 changes: 14 additions & 8 deletions sites/all/modules/contrib/menu_block/menu_block.module
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

/**
* Denotes that the tree should use the menu picked by the curent page.
* Denotes that the tree should use the menu picked by the current page.
*/
define('MENU_TREE__CURRENT_PAGE_MENU', '_active');

Expand Down Expand Up @@ -241,6 +241,7 @@ function menu_block_default_config() {
'admin_title' => '',
'level' => 1,
'follow' => 0,
'display_empty' => 0,
'depth' => 0,
'depth_relative' => 0,
'expanded' => 0,
Expand Down Expand Up @@ -532,13 +533,18 @@ function menu_tree_build(array &$config) {
$data['subject_array'] = $title;
$data['subject'] = drupal_render($title);
$data['content'] = array();
if (!empty($tree) && $output = menu_block_tree_output($tree, $config)) {
$data['content']['#content'] = $output;
$data['content']['#theme'] = array(
'menu_block_wrapper__' . str_replace('-', '_', $config['delta']),
'menu_block_wrapper__' . str_replace('-', '_', $config['menu_name']),
'menu_block_wrapper'
);
if (!empty($tree) || !empty($config['display_empty'])) {
if ($output = menu_block_tree_output($tree, $config)) {
$data['content']['#content'] = $output;
$data['content']['#theme'] = array(
'menu_block_wrapper__' . str_replace('-', '_', $config['delta']),
'menu_block_wrapper__' . str_replace('-', '_', $config['menu_name']),
'menu_block_wrapper'
);
}
else {
$data['content']['#content'] = NULL;
}
$data['content']['#config'] = $config;
$data['content']['#delta'] = $config['delta'];
}
Expand Down
7 changes: 3 additions & 4 deletions sites/all/modules/contrib/menu_block/menu_block_export.info
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ files[] = menu_block_export.admin.inc

configure = admin/config/user-interface/menu-block/export

; Information added by Drupal.org packaging script on 2015-06-30
version = "7.x-2.7"
; Information added by Drupal.org packaging script on 2018-12-04
version = "7.x-2.8"
core = "7.x"
project = "menu_block"
datestamp = "1435676232"

datestamp = "1543950483"
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ function menu_block_menu_tree_content_type_content_types() {
'defaults' => menu_block_get_config(),

// JavaScript and CSS for the config form.
'js' => array(drupal_get_path('module', 'menu_block') . '/menu-block.js'),
'css' => array(drupal_get_path('module', 'menu_block') . '/menu-block-admin.css'),
'js' => array(drupal_get_path('module', 'menu_block') . '/js/menu-block.js'),
'css' => array(drupal_get_path('module', 'menu_block') . '/css/menu-block.admin.css'),
);

$menus = menu_block_get_all_menus();
Expand Down

0 comments on commit 6f3dc0b

Please sign in to comment.