You are here

public function AckMenuMap::objectFormSubmit in Access Control Kit 7

Overrides AccessControlKitHandler::objectFormSubmit().

Overrides AccessControlKitHandler::objectFormSubmit

File

ack_menu/handlers/ack_menu_map.inc, line 226
Contains the handler class for mapping menu links to access realms.

Class

AckMenuMap
Controls access to menu links based on realm mapping.

Code

public function objectFormSubmit($object_type, $menu_link, $form, &$form_state) {
  if (isset($form_state['values']['AckMenuMap'])) {
    $map = $form_state['values']['AckMenuMap'];
    if (isset($map[$this->schemeMachineName]) && is_numeric($map[$this->schemeMachineName])) {
      db_merge('ack_menu_map')
        ->key(array(
        'mlid' => $menu_link['mlid'],
        'scheme' => $this->schemeMachineName,
      ))
        ->fields(array(
        'realm' => $map[$this->schemeMachineName],
      ))
        ->execute();
    }
    else {
      db_delete('ack_menu_map')
        ->condition('mlid', $menu_link['mlid'])
        ->condition('scheme', $this->schemeMachineName)
        ->execute();
    }
  }
}