function _menu_icons_css_generate in Menu Icons 6.2
Same name and namespace in other branches
- 6 menu_icons.module \_menu_icons_css_generate()
Build CSS based on menu IDs
Return value
A string with the CSS
1 call to _menu_icons_css_generate()
- menu_icons_css in ./
menu_icons.module - Page callback for generated CSS file
File
- ./
menu_icons.module, line 191 - Module to associate icons with menu items
Code
function _menu_icons_css_generate() {
// Check if there's already stored data
if ($cache = cache_get('menu_icons')) {
return $cache->data;
}
else {
$result = db_query("SELECT mlid, options FROM {menu_links}");
$size = array_shift(split('x', variable_get('menu_icons_file_validate_image_resolution', '45x45')));
$pos = variable_get('menu_icons_position', 'left');
while ($item = db_fetch_array($result)) {
$options = unserialize($item['options']);
if ($options['menu_icon']['enable'] && !empty($options['menu_icon']['path']) && file_exists($options['menu_icon']['path'])) {
$css .= theme('menu_icons_css_item', $item['mlid'], base_path() . $options['menu_icon']['path'], $size, $pos);
}
}
cache_set('menu_icons', $css);
return $css;
}
}