You are here

function content_access_admin_settings in Content Access 5

Same name and namespace in other branches
  1. 6 content_access.admin.inc \content_access_admin_settings()
  2. 7 content_access.admin.inc \content_access_admin_settings()
1 string reference to 'content_access_admin_settings'
content_access_menu in ./content_access.module

File

./content_access.module, line 187

Code

function content_access_admin_settings($type) {
  $roles = content_access_get_roles_and_author();

  // Per node:
  $form['node'] = array(
    '#type' => 'fieldset',
    '#title' => t('Per node access control settings'),
    '#collapsible' => TRUE,
    '#description' => t('Optionally you can enable per node access control settings. ' . 'Configure access to the per node access settings at drupal\'s access control permission page.'),
  );
  $form['node']['per_node'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable per node access control settings'),
    '#default_value' => content_access_get_settings('per_node', $type),
  );

  // Defaults:
  $form['defaults'] = array(
    '#type' => 'fieldset',
    '#title' => t('Default access control settings'),
    '#collapsible' => TRUE,
    '#description' => t('If per node settings are available, the default settings will be overridden by them.'),
  );
  drupal_add_css(drupal_get_path('module', 'content_access') . '/content_access.css');
  $form['defaults']['view'] = array(
    '#type' => 'checkboxes',
    '#prefix' => '<div class="content_access-div">',
    '#suffix' => '</div>',
    '#options' => $roles,
    '#title' => t('View'),
    '#default_value' => content_access_get_settings('view', $type),
  );
  $form['defaults']['update'] = array(
    '#type' => 'checkboxes',
    '#prefix' => '<div class="content_access-div">',
    '#suffix' => '</div>',
    '#options' => $roles,
    '#title' => t('Edit'),
    '#default_value' => content_access_get_settings('update', $type),
  );
  $form['defaults']['delete'] = array(
    '#type' => 'checkboxes',
    '#prefix' => '<div class="content_access-div">',
    '#suffix' => '</div>',
    '#options' => $roles,
    '#title' => t('Delete'),
    '#default_value' => content_access_get_settings('delete', $type),
  );
  $form['defaults']['clearer'] = array(
    '#value' => '<br clear="all" />',
  );
  $priority = content_access_get_settings('priority', $type);
  $form['advanced'] = array(
    '#type' => 'fieldset',
    '#title' => t('Advanced'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['advanced']['priority'] = array(
    '#type' => 'weight',
    '#title' => t('Give node grants priority'),
    '#default_value' => $priority,
    '#description' => t('If you are only using this access control module, you can safely ignore this. ' . 'If you are using multiple access control modules you can adjust the priority of this module.'),
  );
  $form['type'] = array(
    '#type' => 'value',
    '#value' => $type,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Submit'),
    '#weight' => 10,
  );
  return $form;
}