function og_field_widget_settings_form in Organic groups 7
Implements hook_field_widget_settings_form().
File
- ./
og.field.inc, line 122 - Field module functionality for the Organic groups module.
Code
function og_field_widget_settings_form($field, $instance) {
$widget = $instance['widget'];
$defaults = field_info_widget_settings($widget['type']);
$settings = array_merge($defaults, $widget['settings']);
$form = array();
if ($widget['type'] == OG_AUDIENCE_WIDGET) {
$form['opt_group'] = array(
'#type' => 'radios',
'#title' => t('Input type'),
'#description' => t('Select the input type that should be used to get the groups audience. Note that the <em>Always show "other groups"</em> option will show all groups including the ones the user is a not a member of.'),
'#options' => array(
'auto' => t('Automatically decide the input according to user permissions (Recommended)'),
'never' => t('Never show "other groups"'),
'always' => t('Always show "other groups"'),
),
'#default_value' => $settings['opt_group'],
'#required' => TRUE,
);
}
elseif ($widget['type'] == OG_AUDIENCE_AUTOCOMPLETE_WIDGET) {
$form['autocomplete_match'] = array(
'#type' => 'select',
'#title' => t('Autocomplete matching'),
'#default_value' => $settings['autocomplete_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 nodes.'),
);
$form['size'] = array(
'#type' => 'textfield',
'#title' => t('Size of textfield'),
'#default_value' => $settings['size'],
'#element_validate' => array(
'element_validate_integer_positive',
),
'#required' => TRUE,
);
}
return $form;
}