function interval_field_instance_settings_form in Interval Field 7
Implements hook_field_instance_settings_form().
Allow the user to choose from available periods
File
- ./
interval.module, line 171 - Defines an interval field @copyright Copyright(c) 2011 Rowlands Group @license GPL v2+ http://www.fsf.org/licensing/licenses/gpl.html @author Lee Rowlands leerowlands at rowlandsgroup dot com
Code
function interval_field_instance_settings_form($field, $instance) {
$form = array();
$settings = $instance['settings'];
$widget = $instance['widget']['type'];
if ($widget == 'interval_default') {
$options = array();
$intervals = interval_get_intervals();
foreach ($intervals as $key => $detail) {
$options[$key] = $detail['plural'];
}
$form['allowed_periods'] = array(
'#type' => 'checkboxes',
'#title' => t('Allowed periods'),
'#options' => $options,
'#description' => t('Select the periods you wish to be available in the dropdown. Selecting none will make all of them available.'),
'#default_value' => isset($settings['allowed_periods']) ? $settings['allowed_periods'] : array(),
);
}
return $form;
}