function _node_recur_node_recur_form in Node recur 7
Same name and namespace in other branches
- 7.2 node_recur.pages.inc \_node_recur_node_recur_form()
Helper function to provide the basics of the form
This helps make it available for other modules to use when we might not have a full node yet
Parameters
$type: The node type
2 calls to _node_recur_node_recur_form()
- node_recur_form_alter in ./
node_recur.module - Implements hook_form_alter().
- node_recur_node_recur_form in ./
node_recur.pages.inc - The node recur form
File
- ./
node_recur.pages.inc, line 46
Code
function _node_recur_node_recur_form($type = NULL) {
$form = array();
$form['option'] = array(
'#type' => 'radios',
'#options' => array(
'none' => t('Do not repeat'),
'days' => t('Pick days of the week'),
'rules' => t('Every day, every 2 weeks, etc...'),
),
'#default_value' => 'days',
'#description' => t('Selecting a choice above will reveal more options.'),
);
$form['days'] = array(
'#type' => 'checkboxes',
'#title' => t('Days of the week'),
'#options' => array(
'monday' => t('Monday'),
'tuesday' => t('Tuesday'),
'wednesday' => t('Wednesday'),
'thursday' => t('Thursday'),
'friday' => t('Friday'),
'saturday' => t('Saturday'),
'sunday' => t('Sunday'),
),
);
$form['rules'] = array(
'#type' => 'container',
);
$options = array();
for ($i = 1; $i < 11; $i++) {
$options[$i] = t('Every !i', array(
'!i' => $i == 1 ? '' : $i,
));
}
$form['rules']['frequency'] = array(
'#type' => 'select',
'#title' => t('Repeat'),
'#options' => $options,
);
$form['rules']['period'] = array(
'#type' => 'select',
'#options' => array(
'day' => t('Day(s)'),
'week' => t('Week(s)'),
'month' => t('Month(s)'),
),
);
$form['rules']['exclude_weekends'] = array(
'#type' => 'checkbox',
'#title' => t('Exclude weekends'),
'#description' => t('If checked, weekends will not be included.'),
);
$form['until'] = array(
'#type' => 'textfield',
'#title' => t('Recur until'),
'#description' => t('Repeat this class until the specified date.'),
'#required' => TRUE,
);
if ($max = node_recur_max_future_date_span($type)) {
$form['until']['#description'] .= ' ' . t('This date can only be up to %max in the future.', array(
'%max' => $max,
));
}
drupal_add_library('system', 'ui.datepicker');
$form['#attached']['js'][] = drupal_get_path('module', 'node_recur') . '/node_recur.js';
return $form;
}