Store Links Block

Posts: 8
Joined: 09/28/2007
Bug Finder

Hi,

The markup generated by the theme_uc_store_block_links() function in uc_store.module includes many redundant UL elements, causing strict validation to fail.

This can be fixed by checking the output of theme_uc_store_block_links() and only wrapping it in UL tags when necessary.

Here is a modified version that fixes the problem ... I hope it can be incorporated into the code, but I'm not sure who to contact.

<?php
function theme_uc_store_block_links($menu){
  if (!(
$menu['type'] & MENU_VISIBLE_IN_TREE)){
    return
'';
  }
 
$depth = count(explode('/', $menu['path']));
 
$link_title = uc_store_get_icon($menu['path'], TRUE) .' '. $menu['title'];
 
$output = str_repeat("  ", $depth) .'<li>'
         
. l($link_title, $menu['path'], array(), NULL, NULL, FALSE, TRUE);
  if (
is_array($menu['children']) && !empty($menu['children'])){
   
usort($menu['children'], '_menu_sort');
   
$kid_output='';
    foreach (
$menu['children'] as $child){
     
$kid_output .= theme('uc_store_block_links', menu_get_item($child));
    }
    if(
$kid_output) {
     
$output .= "\n". str_repeat(" ", 2 * $depth + 1) ."<ul>\n";
     
$output .= $kid_output;
     
$output .= str_repeat(" ", 2 * $depth + 1) ."</ul>\n". str_repeat("  ", $depth);
    }

  }
 
$output .= "</li>\n";
  return
$output;
}
?>

cheers,

Matt

Posts: 5617
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

I'll pass this on to Shawn. I had him update the store links block to work on either the right or left side of the screen and make it finally work in IE. I'm sure he'll be able to incorporate your fix, too. Cool

Posts: 332
Joined: 08/07/2007
Administrator

You're fix has now been committed to uc_store. Thanks for the help!

--

-Shawn Conn: If the Name Don't Rhyme It Ain't Mine