I have a menu callback, and I want to add a form on it using the following code.
function parking_calculator_menu() {
$items['admin/parkingcalculator'] = array(
'title' => 'Node parkingCalculator',
'description' => 'Adjust node parkingCalculator options.',
'position' => 'right',
'weight' => -5,
'page callback' => 'get_form',
'access arguments' => array('administer site configuration'),
);
return $items;
}
function get_form() {
$form['short-term-parking'] = array(
'#title' => t('Short term parking'),
'#type' => 'fieldset',
'#description' => t('Short term parking.'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['short-term-parking']['free_time'] = array(
'#type' => 'textfield',
'#required' => TRUE,
'#title' => t('Free time'),
'#default_value' => variable_get('free_time', 1),
'#description' => t('Please enter Free time.')
);
$form['short-term-parking']['long-term-starts'] = array(
'#title' => t('Long term starts'),
'#type' => 'textfield',
'#default_value' => variable_get('long-term-starts', 1),
'#required' => TRUE,
'#description' => t('Please enter Long term starts.')
);
$form['short-term-parking']['first-hour-cost'] = array(
'#title' => t('First hour cost'),
'#type' => 'textfield',
'#default_value' => variable_get('first-hour-cost', 1),
'#required' => TRUE,
'#description' => t('Please enter First hour cost.')
);
$form['short-term-parking']['each-hour-cost'] = array(
'#title' => t('Each hour cost'),
'#type' => 'textfield',
'#default_value' => variable_get('each-hour-cost', 1),
'#required' => TRUE,
'#description' => t('Please enter Each hour cost.')
);
$form['long-term-parking'] = array(
'#title' => t('Long term parking'),
'#type' => 'fieldset',
'#description' => t('Long term parking.'),
'#collapsible' => TRUE,
'#collapsed' => FALSE
);
$form['long-term-parking']['free_timel'] = array(
'#type' => 'textfield',
'#required' => TRUE,
'#default_value' => variable_get('free_timel', 1),
'#title' => t('Free time'),
'#description' => t('Please enter Free time.')
);
$form['long-term-parking']['long-term-startsl'] = array(
'#title' => t('Long term starts'),
'#default_value' => variable_get('long-term-startsl', 1),
'#type' => 'textfield',
'#required' => TRUE,
'#description' => t('Please enter Long term starts.')
);
$form['long-term-parking']['first-hour-costl'] = array(
'#title' => t('First hour cost'),
'#type' => 'textfield',
'#default_value' => variable_get('first-hour-costl', 1),
'#required' => TRUE,
'#description' => t('Please enter First hour cost.')
);
$form['long-term-parking']['each-hour-costl'] = array(
'#title' => t('Each hour cost'),
'#type' => 'textfield',
'#default_value' => variable_get('each-hour-costl', 1),
'#required' => TRUE,
'#description' => t('Please enter Each hour cost.')
);
$form['valet-parking'] = array(
'#title' => t('Valet parking'),
'#type' => 'fieldset',
'#description' => t('Valet parking.'),
'#collapsible' => TRUE,
'#collapsed' => FALSE
);
$form['valet-parking']['first-hour-costv'] = array(
'#title' => t('First hour cost'),
'#type' => 'textfield',
'#default_value' => variable_get('first-hour-costv', 1),
'#required' => TRUE,
'#description' => t('Please enter First hour cost.')
);
$form['valet-parking']['each-hour-costv'] = array(
'#title' => t('Each hour cost'),
'#type' => 'textfield',
'#default_value' => variable_get('each-hour-costv', 1),
'#required' => TRUE,
'#description' => t('Please enter Each hour cost.')
);
return system_settings_form($form);
}
With this code, I get the following error message:
Recoverable fatal error: Argument 1 passed to drupal_attributes() must be an array, null given, called in /var/www/html/APIG01JO2012039/includes/form.inc on line 3252 and defined in drupal_attributes() (line 2366 of /var/www/html/APIG01JO2012039/includes/common.inc). The website encountered an unexpected error. Please try again later.
Why am I getting that error?