contentsadminrelink.module 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <?php
  2. /**
  3. * @file
  4. * This is the file description for Contentsadminrelink module.
  5. *
  6. * In this more verbose, multi-line description, you can specify what this
  7. * file does exactly. Make sure to wrap your documentation in column 78 so
  8. * that the file can be displayed nicely in default-sized consoles.
  9. */
  10. /**
  11. * Implements hook_menu().
  12. */
  13. function contentsadminrelink_menu() {
  14. $items = array();
  15. return $items;
  16. }
  17. /**
  18. * Implements hook_url_outbound_alter().
  19. */
  20. # useless, just play with perms and menu_alter
  21. // function contentsadminrelink_url_outbound_alter(&$path, &$options, $original_path) {
  22. // if ($path == 'admin/content' || $path == 'admin/content/node') {
  23. // $path = 'admin/content/nodes';
  24. // }
  25. //}
  26. /**
  27. * Implements hook_permission().
  28. */
  29. function contentsadminrelink_permission() {
  30. return array(
  31. 'access core content overview' => array(
  32. 'title' => t('Access core content overview'),
  33. // 'description' => t('Perform administration tasks for my module.'),
  34. ),
  35. 'access core media overview' => array(
  36. 'title' => t('Access classic media overview'),
  37. // 'description' => t('Perform administration tasks for my module.'),
  38. ),
  39. );
  40. }
  41. /**
  42. * Implements hook_menu_alter().
  43. */
  44. function contentsadminrelink_menu_alter(&$items) {
  45. // dsm($items, '$items');
  46. if(isset($items['admin/content']))
  47. $items['admin/content']['access arguments'] = array('access core content overview');
  48. if(isset($items['admin/content/node']))
  49. $items['admin/content/node']['access arguments'] = array('access core content overview');
  50. if(isset($items['admin/content/media']))
  51. $items['admin/content/media']['access arguments'] = array('access classic media overview');
  52. // dsm($items, '$items');
  53. }
  54. /**
  55. * Implements hook_menu_local_tasks_alter().
  56. */
  57. function contentsadminrelink_menu_local_tasks_alter(&$data, $router_item, $root_path) {
  58. switch($root_path){
  59. case 'admin/content/nodes' : // for example 'page/view/news'
  60. $item = menu_get_item('node/add');
  61. if ($item['access']) {
  62. $data['actions']['output'][] = array(
  63. '#theme' => 'menu_local_action',
  64. '#link' => $item,
  65. );
  66. }
  67. break;
  68. // case 'admin/content/medias' : // for example 'page/view/news'
  69. // $item = menu_get_item('admin/content/media/import');
  70. // if ($item['access']) {
  71. // $data['actions']['output'][] = array(
  72. // '#theme' => 'menu_local_action',
  73. // '#link' => $item,
  74. // );
  75. // }
  76. // break;
  77. }
  78. }