Drupal: expand menu by default

Example: to expand primary links by default, add this hook to your module:

/**
 * Implementation of hook_menu_link_alter().
 *
 */
function editor_menu_link_alter(&$item, $menu) {
	if($item['menu_name'] == 'primary-links')
	{
		$item['expanded'] = 1;
	}
}

Notes

  • is called when a primary link is added or modified
  • tested with Drupal 6

Feedback