function weather_es_configuration_form in Weather_es 6.2
Show a configuration page for a custom weather_es block
1 string reference to 'weather_es_configuration_form'
- weather_es_menu in ./
weather_es.module - Implementation of hook_menu().
File
- ./
weather_es.module, line 165 - Shows weather data of Spain (by AEMET)
Code
function weather_es_configuration_form($form_state, $wuid) {
if (!isset($form_state['values'])) {
$step = 1;
}
else {
$step = $form_state['values']['step'] + 1;
}
$form['step'] = array(
'#type' => 'value',
'#value' => $step,
);
switch ($step) {
case 1:
// Page 1
$form['provincia'] = array(
'#type' => 'fieldset',
'#title' => t('Select a province'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#tree' => TRUE,
);
$form['provincia']['seleccionada'] = array(
'#type' => 'select',
'#title' => t('Province'),
'#default_value' => 00,
'#options' => _weather_es_provincies(),
'#description' => t('Province of the city'),
);
break;
case 2:
// Show page 2
$form['poblacion'] = array(
'#type' => 'fieldset',
'#title' => t('Select a city'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#tree' => TRUE,
);
$form['poblacion']['seleccionada'] = array(
'#type' => 'select',
'#title' => t('City'),
'#options' => _weather_es_cities($form_state['values']['provincia']['seleccionada']),
'#description' => t('City to show the forecast'),
);
$form['idioma'] = array(
'#type' => 'radios',
'#title' => t('Languages'),
'#options' => array(
'es' => t('Spanish'),
'ca' => t('Catalan'),
'eu' => t('Euskera'),
'gl' => t('Galician'),
'en' => t('English'),
'fr' => t('French'),
),
'#description' => t('Choose the language you will see the weather data.'),
'#default_value' => 'es',
);
$form['save'] = array(
'#type' => 'submit',
'#value' => t('Save configuration'),
);
$form['add'] = array(
'#type' => 'submit',
'#value' => t('Add new location'),
);
$form['wuid'] = array(
'#type' => 'value',
'#value' => $wuid,
);
break;
}
$form['next'] = array(
'#type' => 'button',
'#value' => t('Next'),
);
// Hide the button at last step
if ($step >= 2) {
$form['next'] = array(
'#type' => 'hidden',
);
}
return $form;
}