function access_scheme_list_field_settings in Access Control Kit 7
Settings callback for the list field scheme types.
See also
1 string reference to 'access_scheme_list_field_settings'
- access_access_scheme_info in ./
access.access.inc - Implements hook_access_scheme_info().
File
- callbacks/
access.list.inc, line 25 - Callback functions for the list field access scheme types.
Code
function access_scheme_list_field_settings($scheme, $has_data) {
// Find all available fields of the given type.
$fields = field_read_fields(array(
'type' => $scheme->type,
));
// Exclude other realm fields from the list.
foreach ($fields as $field_name => $field) {
if (!empty($field['settings']['allowed_values_function']) && $field['settings']['allowed_values_function'] == '_access_field_allowed_values') {
unset($fields[$field_name]);
}
}
// Build the form.
$form = array();
if (!empty($fields)) {
$options = drupal_map_assoc(array_keys($fields));
$form['field_name'] = array(
'#type' => 'select',
'#title' => t('List field'),
'#description' => t('The allowed values list from this field will become the access realms for the scheme.'),
'#default_value' => isset($scheme->settings['field_name']) ? $scheme->settings['field_name'] : NULL,
'#options' => $options,
'#required' => TRUE,
'#disabled' => $has_data,
);
}
return $form;
}