You are here

function content_access_page_submit in Content Access 7

Same name and namespace in other branches
  1. 5 content_access.module \content_access_page_submit()
  2. 6 content_access.admin.inc \content_access_page_submit()

Submit callback for content_access_page().

File

./content_access.admin.inc, line 75
Content access administration UI.

Code

function content_access_page_submit($form, &$form_state) {
  $settings = array();
  $node = $form_state['node'];
  foreach (_content_access_get_operations() as $op => $label) {

    // Set the settings so that further calls will return this settings.
    $settings[$op] = array_keys(array_filter($form_state['values'][$op]));
  }

  // Save per-node settings.
  content_access_save_per_node_settings($node, $settings);
  if (module_exists('acl')) {
    foreach (array(
      'view',
      'update',
      'delete',
    ) as $op) {
      acl_save_form($form_state['values']['acl'][$op]);
      module_invoke_all('user_acl', $settings);
    }
  }

  // Apply new settings.
  node_access_acquire_grants($node);
  cache_clear_all();
  module_invoke_all('per_node', $settings, $node);
  drupal_set_message(t('Your changes have been saved. You may have to !rebuild for your changes to take effect.', array(
    '!rebuild' => l(t('rebuild permissions'), 'admin/reports/status/rebuild'),
  )));
}