Scroll
Ссылки добавить контент в Drupal 7 Admin menu
Новый модуль toolbar, конечно выглядит лучше, admin menu. Но мне зато в admin menu можно добавить сколько угодно ссылок и они ВСЕ будут доступны одним кликом мыши.
Поэтому я хочу использовать admin menu. Устанавливаю его и вижу кракозяблы... Проблемы в кодировке.
Заходим в .htaccess и добавляем в конец файла строку:
AddDefaultCharset UTF-8
Теперь стало все нормально, вижу русские буквы, но.. Нет ссылки добавить контент, нужно добавить его заново. Для этого нужно создать свой модуль и добавить туда такой вот код:
<?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
И вот после этих небольших правках мы увидим admin menu, которое нравится мне. А toolbar можно и отключить.