You are here

function content_access_force_permissions in Content Access 7

Same name and namespace in other branches
  1. 6 content_access.admin.inc \content_access_force_permissions()

Formapi #after_build callback, that disables checkboxes for roles without access to content.

1 string reference to 'content_access_force_permissions'
content_access_page in ./content_access.admin.inc
Per node settings page.

File

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

Code

function content_access_force_permissions($element, &$form_state) {
  foreach (array(
    'update',
    'update_own',
    'delete',
    'delete_own',
  ) as $op) {
    foreach (content_access_get_settings($op, $form_state['node']->type) as $rid) {
      $element[$op][$rid]['#disabled'] = TRUE;
      $element[$op][$rid]['#attributes']['disabled'] = 'disabled';
      $element[$op][$rid]['#value'] = TRUE;
      $element[$op][$rid]['#checked'] = TRUE;
      $element[$op][$rid]['#prefix'] = '<span' . drupal_attributes(array(
        'title' => t("Permission is granted due to the content type's access control settings."),
      )) . '>';
      $element[$op][$rid]['#suffix'] = "</span>";
    }
  }
  return $element;
}