In order to get the styling I was looking for with imagemenu, I needed to get the menu items out of the table. This patch adds support for a 3rd output type, called 'div' that simply wraps the link/flyover/img menu items in divs, no tables.

Generated HTML has enclosing div of class .imagemenu
Each menu item div of class .imagemenu-item
Intended that the admin will then style it with CSS

This is tested, working. Let me know if you see any problems. Would love to get this in a future release. Thanks!

--- temp/imagemenu/imagemenu.module 2007-03-20 04:44:07.000000000 -0700
+++ imagemenu/imagemenu.module 2007-05-03 16:06:06.000000000 -0700
@@ -396,6 +396,9 @@ function imagemenu_display($mid, $full =
case 'horizontal':
$output = imagemenu_build_table_horizontal($mid, $full);
break;
+ case 'div':
+ return imagemenu_build_div_output($mid, $full);
+ break;
}
return theme('table', array(), $output);
}
@@ -419,7 +422,7 @@ function imagemenu_settings() {
$form['admin_settings']['imagemenu_layout'] = array(
'#type' => 'select',
'#title' => t('Layout'),
- '#options' => array('vertical' => 'vertical', 'horizontal' => 'horizontal'),
+ '#options' => array('vertical' => 'vertical', 'horizontal' => 'horizontal', 'div' => 'div'),
'#default_value' => variable_get('imagemenu_layout', 'vertical'),
'#description' => t('The orientation of the menu.'),
);
@@ -600,6 +603,26 @@ function imagemenu_build_table_horizonta
return $output;
}

+/*
+* 'div' HTML output generator. Alternative to 'vertical' and 'horizontal' table alternatives
+*
+* Generated HTML has enclosing div of class .imagemenu
+* Each menu item div of class .imagemenu-item
+* Intended that the admin will then style it with CSS
+*
+* @return displayable HTML for the 'div' output alternative
+*
+*/
+function imagemenu_build_div_output($mid, $full = FALSE) {
+ $menus = imagemenu_fetch_rows($mid, $full);
+ $output = '

';
+ foreach ($menus as $menu) {
+ $output .= '
' . imagemenu_fetch_item($menu, $mid) . '

';
+ }
+ $output .= '

';
+ return $output;
+}
+
function imagemenu_show_visible_tree() {
$path = $_GET['q'];
$output = array();

CommentFileSizeAuthor
im_div_diff.txt1.71 KBberniet

Comments

pobster’s picture

Status: Needs review » Closed (fixed)

Nice idea, thanks! http://drupal.org/node/142220

Pobster