You are here

function flexiaccess_admin_content in Flexi Access 7

Form builder to display a listing of content types and their ACL status.

1 string reference to 'flexiaccess_admin_content'
flexiaccess_menu in ./flexiaccess.module
Implements hook_menu().

File

./flexiaccess.admin.inc, line 13
Administrative page callbacks for the Flexi access module.

Code

function flexiaccess_admin_content($form, &$form_state) {

  // Set breadcrumb explictly (I've no idea why this is necessary here).
  $breadcrumb = array(
    l('Home', '<front>'),
    l('Administration', 'admin'),
    l('Configuration', 'admin/config'),
    l('People', 'admin/config/people'),
  );
  drupal_set_breadcrumb($breadcrumb);
  $names = node_type_get_names();
  $flexiaccess_types = variable_get('flexiaccess_types', array());
  $form = array();
  $form['flexiaccess']['types'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Content types:'),
    '#default_value' => variable_get('flexiaccess_types', array()),
    '#options' => $names,
    '#description' => t('Check the content types you want to assign ACLs using Flexi access.  Then press &#8220;Save&#8221;.'),
  );
  $flexiaccess_types_enabled = array_filter($flexiaccess_types);
  $form['flexiaccess']['typesettings'] = array(
    '#type' => 'fieldset',
    '#tree' => TRUE,
    '#title' => t('Per-type settings'),
    '#description' => t('To configure flexiaccess settings for a specific content type, enable it first, above.'),
  );
  foreach ($flexiaccess_types_enabled as $type) {
    $form['flexiaccess']['typesettings'][$type] = array(
      '#type' => 'fieldset',
      '#title' => $names[$type],
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
    );
    $form['flexiaccess']['typesettings'][$type]['autoACL'] = array(
      '#type' => 'checkbox',
      '#title' => t('Automatic ACL creation'),
      '#description' => t('Enable this for content types which should have restricted access by default. This will create an empty ACL for every new node created, thereby restricting access to the node by all users. This does not affect existing nodes.'),
      '#default_value' => variable_get('flexiaccess_typesettings_' . $type . '_autoACL', 0),
    );
  }
  $form['flexiaccess']['priority'] = array(
    '#type' => 'textfield',
    '#size' => 2,
    '#title' => t('Default priority for new ACL entries'),
    '#default_value' => variable_get('flexiaccess_priority', 0),
    '#description' => t('With every ACL entry (which translate to entries in the node_access table) there is an associated priority.  You only need to change this if you understand what it does, and you want to integrate Flexi access with other access control modules.  Note that changing this value does not change previously created ACL entries.'),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save settings'),
  );
  return $form;
}