Advertisement
Guest User

Untitled

a guest
Jul 29th, 2015
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. function vts_dashboard_menu() {
  2.  
  3. $items['admin/backoffice/production'] = array(
  4. 'title' => 'Production',
  5. 'description' => 'Edit catalogue',
  6. 'page callback' => 'vts_dashboard_backoff_circuits',
  7. 'access callback' => 'vts_dashboard_user_has_role',
  8. 'access arguments' => array('éditeur voyages', 'éditeur taxonomie', 'administrator'),
  9. 'type' => MENU_NORMAL_ITEM,
  10. 'menu_name' => 'management',
  11.  
  12. //2 alternative tests below. EVEN WITH TRUE, doesn't show up for non admin
  13. //'access callback' => TRUE,
  14. //OR ...
  15. //'access callback' => 'node_access',
  16. //'access arguments' => array('view', 1),
  17. );
  18.  
  19. $items['admin/backoffice/production/circuits'] = array(
  20. 'title' => 'Circuits',
  21. 'type' => MENU_DEFAULT_LOCAL_TASK,
  22. 'weight' => -10,
  23. 'access callback' => 'vts_dashboard_user_has_role',
  24. 'access arguments' => array('éditeur voyages', 'administrator'),
  25. );
  26. // ... more items...
  27. );
  28. //page callback function
  29. function vts_dashboard_backoff_circuits(){
  30. $viewname = 'circuits_vts';
  31. $viewdisplay = 'backoffice_products_list';
  32. return views_embed_view($viewname, $viewdisplay);
  33. }
  34. //access callback function
  35. function vts_dashboard_user_has_role() {
  36. global $user;
  37. $roles = func_get_args();
  38. foreach ($roles as $role) {
  39. if (in_array($role, $user->roles)) {
  40. return TRUE;
  41. }
  42. }
  43. return FALSE;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement