You are here

function ack_menu_link_add in Access Control Kit 7

Menu page callback to add a menu link to a realm.

Parameters

object $scheme: An access scheme.

int $realm: A realm value.

Return value

array A renderable form.

1 string reference to 'ack_menu_link_add'
ack_menu_menu in ack_menu/ack_menu.module
Implements hook_menu().

File

ack_menu/ack_menu.pages.inc, line 301
Page callbacks for managing menu links in assigned realms.

Code

function ack_menu_link_add($scheme, $realm) {
  module_load_include('inc', 'menu', 'menu.admin');
  $handler = $scheme->handlers['menu_link'];
  $menu_name = $handler
    ->realmMenu($realm);
  $menu = empty($menu_name) ? menu_load('navigation') : menu_load($menu_name);
  $form_state = array(
    'ack_menu' => array(
      'schemes' => array(
        $scheme,
      ),
      'realms' => array(
        $scheme->machine_name => array(
          $realm,
        ),
      ),
      'destination' => 'ack_menu/manage/' . $scheme->machine_name . '/' . $realm,
    ),
    'build_info' => array(
      'args' => array(
        'add',
        NULL,
        $menu,
      ),
    ),
  );
  return drupal_build_form('menu_edit_item', $form_state);
}