Hi everyone,
Static methods used as access callbacks in hook_menu() are currently blocked by the following line in menu.inc
646 | elseif (function_exists($callback)) {
Im recommending replacing this with is_callbable to allow use of static methods.
646 | elseif (is_callable($callback)) {
Adding this will allow static methods to be provided using there fully qualified name.
Mirroring the functionality already available in the 'page callback' attribute
Example:
$items['add-product'] = array('title' => 'Add Product','description' => 'Add a product','page callback' => 'drupal_get_form','page arguments' => array('add_product_form'),'file' => 'forms/product/form.addedit.inc','access callback' => 'Menu\MenuAccess::hasPermissions','access arguments' => array('access administration pages', 'add product'),'type' => MENU_LOCAL_ACTION
);
UPDATE: Updated the patch to allow theme callbacks to be static methods.
Process is the same, static methods as theme callbacks are blocked by a 'function_exists' call, replace with a 'is_callable' call