Sudev
Sudev

Reputation: 11

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

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 ?

Upvotes: 1

Views: 81

Answers (1)

skarist
skarist

Reputation: 1030

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
   );

Upvotes: 1

Related Questions