1

Is there way to use Drupal menu's "page arguments" in the "access callback" function? I need to use both 'access arguments' and 'access callback'

'page arguments' => array(3, 4),

'access arguments' => array('access mymodule data'),

'access callback' => 'mymodule_application_page_access',

Is it possible to use values passed as "page arguments" in my "access callback" method - mymodule_application_page_access ?

apaderno
  • 28,547
  • 16
  • 75
  • 90
Sudev
  • 11
  • 3

1 Answers1

1

Sure, you can do:

    $menu['mymodule/path1/path2/%/%'] = array(
         //.... some stuff
        'page callback' => 'mymodule_somecallback',
        'page arguments' => array(3, 4),
        'access arguments' => array('access mymodule data',3,4),
        'access callback' => 'mymodule_application_page_access',
        //.... some more stuff
   );
skarist
  • 1,030
  • 7
  • 9
  • Thanks skarist! I tried that earlier but got an error and then I realized I had considered only 2 arguments instead of 3 in the access callback method! My mistake :) – Sudev Aug 11 '14 at 09:35