Contents
What does the access callback do in Drupal?
“access callback”: A function returning TRUE if the user has access rights to this menu item, and FALSE if not. It can also be a boolean constant instead of a function, and you can also use numeric values (will be cast to boolean).
What does hook menu ( ) do in Drupal?
hook_menu () implementations return an associative array whose keys define paths and whose values are an associative array of properties for each path. (The complete list of properties is in the return value section below.) The definition for each path may include a page callback function, which is invoked when the registered path is requested.
When to use optional path arguments in Drupal?
When ‘abc/def/123/foo’ is requested, $ghi will be ‘123’ and $jkl will be ‘foo’. Note that this automatic passing of optional path arguments applies only to page and theme callback functions. In addition to optional path arguments, the page callback and other callback functions may specify argument lists as arrays.
What does Drupal _ get _ form ( ) do?
Special care should be taken for the page callback drupal_get_form (), because your specific form callback function will always receive $form and &$form_state as the first function arguments: See Form API documentation for details. Wildcards within paths also work with integer substitution.
Which is the first argument in the page callback function?
When path ‘abc/def’ is requested, the page callback function will get ‘def’ as the first argument and (always) ‘foo’ as the second argument.
When to pass list array to page callback function?
If a page callback function uses an argument list array, and its path is requested with optional path arguments, then the list array’s arguments are passed to the callback function first, followed by the optional path arguments.
When to use integers in a callback function?
When integers are used and the callback function is called, the corresponding path components will be substituted for the integers. That is, the integer 0 in an argument list will be replaced with the first path component, integer 1 with the second, and so on (path components are numbered starting from zero).
What is the return value of Hook menu?
hook_menu () implementations return an associative array whose keys define paths and whose values are an associative array of properties for each path. (The complete list of properties is in the return value section below.)
function hook_menu. Define menu items and page callbacks. This hook enables modules to register paths in order to define how URL requests are handled. Paths may be registered for URL handling only, or they can register a link to be placed in a menu (usually the Navigation menu).