function tac_lite_admin_settings in Taxonomy Access Control Lite 6
Same name and namespace in other branches
- 5 tac_lite.module \tac_lite_admin_settings()
- 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 85 - 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 <a href="!url">create a vocabulary</a> before you can use tac_lite.', array(
'!url' => url('admin/content/taxonomy/add/vocabulary'),
)),
);
return $form;
}
else {
$options = array();
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. <br/>Use caution with hierarchical (nested) taxonomies as <em>visibility</em> settings may cause problems on node edit forms.<br/>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.'),
'#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';
return $ret;
}
}