You are here

function tac_lite_admin_settings in Taxonomy Access Control Lite 5

Same name and namespace in other branches
  1. 6 tac_lite.module \tac_lite_admin_settings()
  2. 7 tac_lite.module \tac_lite_admin_settings()

Returns the settings form

1 string reference to 'tac_lite_admin_settings'
tac_lite_menu in ./tac_lite.module
Implementation of hook_menu().

File

./tac_lite.module, line 81
Control access to site content based on taxonomy, roles and users.

Code

function tac_lite_admin_settings() {
  $vocabularies = taxonomy_get_vocabularies();
  if (!count($vocabularies)) {
    $form['body'] = array(
      '#type' => 'markup',
      '#value' => t('You must create a vocabulary before you can use tac_lite.'),
    );
    return $form;
  }
  else {
    foreach ($vocabularies as $vid => $vocab) {
      $options[$vid] = $vocab->name;
    }
    $form['tac_lite_categories'] = array(
      '#type' => 'select',
      '#title' => t('Vocabularies'),
      '#default_value' => variable_get('tac_lite_categories', null),
      '#options' => $options,
      '#description' => t('Select one or more vocabularies to control privacy.  Do not select free tagging vocabularies, they are not supported.'),
      '#multiple' => TRUE,
      '#required' => TRUE,
    );
    $scheme_options = array();

    // Currently only view, edit, delete permissions possible, so 7
    // permutations will be more than enough.
    for ($i = 1; $i < 8; $i++) {
      $scheme_options[$i] = $i;
    }
    $form['tac_lite_schemes'] = array(
      '#type' => 'select',
      '#title' => t('Schemes'),
      '#description' => t('Each scheme allows for a different set of permissions.  For example, use scheme 1 for read-only permission; scheme 2 for read and update; scheme 3 for delete; etc.  Additional schemes increase the size of your node_access table, so use no more than you need.  Also note that ff you use tac_lite to assign update permission, it is recommended that you give those users read permission on all terms of that vocabulary.'),
      '#default_value' => variable_get('tac_lite_schemes', 1),
      '#options' => $scheme_options,
      '#required' => TRUE,
    );
    $ret = system_settings_form($form);

    // Special handling is required when this form is submitted.
    $ret['#submit']['_tac_lite_admin_settings_submit'] = array();
    return $ret;
  }
}