function rolereference_widget_settings in Role Reference 6
Implementation of hook_widget_settings().
File
- ./
rolereference.module, line 352 - Defines a field type for referencing a role. Based almost entirely on nodereference and userreference modules.
Code
function rolereference_widget_settings($op, $widget) {
switch ($op) {
case 'form':
$form = array();
$match = isset($widget['autocomplete_match']) ? $widget['autocomplete_match'] : 'contains';
if ($widget['type'] == 'rolereference_autocomplete') {
$form['autocomplete_match'] = array(
'#type' => 'select',
'#title' => t('Autocomplete matching'),
'#default_value' => $match,
'#options' => array(
'starts_with' => t('Starts with'),
'contains' => t('Contains'),
),
'#description' => t('Select the method used to collect autocomplete suggestions. Note that <em>Contains</em> can cause performance issues on sites with thousands of roles.'),
);
}
else {
$form['autocomplete_match'] = array(
'#type' => 'hidden',
'#value' => $match,
);
}
return $form;
case 'save':
return array(
'autocomplete_match',
);
}
}