You are here

function nodeaccess_save_role_aliases in Nodeaccess 7

Same name and namespace in other branches
  1. 5 nodeaccess.module \nodeaccess_save_role_aliases()
  2. 6.2 nodeaccess.module \nodeaccess_save_role_aliases()
  3. 6 nodeaccess.module \nodeaccess_save_role_aliases()

Save a role alias.

Parameters

array $edit: An array of aliases to save, indexed by rid.

1 call to nodeaccess_save_role_aliases()
nodeaccess_admin_form_submit in ./nodeaccess.admin.inc
Submit function for nodeaccess_admin_form.

File

./nodeaccess.module, line 863
Provide per node access control

Code

function nodeaccess_save_role_aliases($edit) {
  db_delete('nodeaccess_role_alias')
    ->execute();
  if (is_array($edit)) {
    foreach ($edit as $key => $value) {
      db_insert('nodeaccess_role_alias')
        ->fields(array(
        'rid' => $key,
        'name' => $value['name'],
        'weight' => $value['weight'],
      ))
        ->execute();
    }
  }
  return;
}