Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function vts_dashboard_menu() {
- $items['admin/backoffice/production'] = array(
- 'title' => 'Production',
- 'description' => 'Edit catalogue',
- 'page callback' => 'vts_dashboard_backoff_circuits',
- 'access callback' => 'vts_dashboard_user_has_role',
- 'access arguments' => array('éditeur voyages', 'éditeur taxonomie', 'administrator'),
- 'type' => MENU_NORMAL_ITEM,
- 'menu_name' => 'management',
- //2 alternative tests below. EVEN WITH TRUE, doesn't show up for non admin
- //'access callback' => TRUE,
- //OR ...
- //'access callback' => 'node_access',
- //'access arguments' => array('view', 1),
- );
- $items['admin/backoffice/production/circuits'] = array(
- 'title' => 'Circuits',
- 'type' => MENU_DEFAULT_LOCAL_TASK,
- 'weight' => -10,
- 'access callback' => 'vts_dashboard_user_has_role',
- 'access arguments' => array('éditeur voyages', 'administrator'),
- );
- // ... more items...
- );
- //page callback function
- function vts_dashboard_backoff_circuits(){
- $viewname = 'circuits_vts';
- $viewdisplay = 'backoffice_products_list';
- return views_embed_view($viewname, $viewdisplay);
- }
- //access callback function
- function vts_dashboard_user_has_role() {
- global $user;
- $roles = func_get_args();
- foreach ($roles as $role) {
- if (in_array($role, $user->roles)) {
- return TRUE;
- }
- }
- return FALSE;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement