Scroll
Links to add content to Drupal 7 Admin menu
The new toolbar module certainly looks better than admin menu. But I like admin menu because I can add as many links as I want and they are ALL accessible with a single mouse click.
That's why I want to use admin menu. I install it and see garbled characters... Encoding problems.
Let's open the .htaccess file and add the following line at the end:
AddDefaultCharset UTF-8
Now everything looks fine, I see Russian characters, but... There is no "Add content" link, we need to add it manually. To do this, create your own module and add the following code:
<?php
/**
* @file
* Adds "Create Content" links to the Admin Menu, and removes "Tasks" and "Index".
*/
/**
* Implementation of hook_admin_menu_output_alter().
*
* Add "Create content" as a top level submenu in the admin menu.
*/
function custom_admin_menu_output_alter(&$content) {
// Add a top level item for the Create content menu itself.
$content['create_content_links'] = array(
'#theme' => 'admin_menu_links',
'#weight' => -99,
'#sorted' => TRUE,
);
// Copy the create content submenu to our backend menu.
$content['create_content_links']['create-content'] = array(
'#title' => t('Create'),
'#href' => 'node/add',
'#weight' => -10,
);
foreach(node_type_get_types() as $type => $object) {
if (node_access('create', $type)) {
$node_type_url = str_replace('_', '-', $type);
$content['create_content_links']['create-content'][$node_type_url] = array(
'#title' => $object->name,
'#href' => 'node/add/'. $node_type_url,
);
} // end if node_access
} // end 'foreach'
// Remove "Tasks" and "Index" from Admin Menu output
$admin_menu_exclusions = array(
t('Tasks'),
t('Index'),
);
foreach($content['menu'] as $menu_key => $menu_tree) {
if (in_array($menu_tree['#title'], $admin_menu_exclusions))
unset($content['menu'][$menu_key]);
}
} // end hook_admin_menu_output_alter
And after these minor tweaks we’ll see the admin menu that I like. The toolbar can be disabled.