function _webform_edit_addressfield in Addressfield Tokens 7
Generate the form for editing a component.
Create a set of form elements to be displayed on the form for editing this component. Use care naming the form items, as this correlates directly to the database schema. The component "Name" and "Description" fields are added to every component type and are not necessary to specify here (although they may be overridden if desired).
Parameters
mixed $component: A Webform component array.
Return value
array An array of form items to be displayed on the edit component page
File
- ./
addressfield_tokens.components.inc, line 48 - Webform Component information for an address field type.
Code
function _webform_edit_addressfield($component) {
$form = array();
$form['extra']['available_countries'] = array(
'#type' => 'select',
'#multiple' => TRUE,
'#title' => t('Available countries'),
'#description' => t('If no countries are selected, all countries will be available.'),
'#options' => _addressfield_country_options_list(),
'#default_value' => $component['extra']['available_countries'],
);
$form['extra']['default_country'] = array(
'#type' => 'select',
'#multiple' => FALSE,
'#title' => t('Default country'),
'#description' => t('Select which country should be selected as the default.'),
'#options' => array_merge(array(
0 => t('- None -'),
), _addressfield_country_options_list()),
'#default_value' => $component['extra']['default_country'],
);
$form['extra']['format_handlers'] = array(
'#type' => 'checkboxes',
'#title' => t('Format handlers'),
'#options' => addressfield_format_plugins_options(),
'#required' => TRUE,
'#default_value' => !empty($component['extra']['format_handlers']) ? $component['extra']['format_handlers'] : array(
'address',
),
);
$form['extra']['csv_separate'] = array(
'#type' => 'radios',
'#title' => t('CSV download'),
'#description' => t('How would you like addresses presented in CSV downloads?'),
'#options' => array(
0 => t('Display entire address in a single column'),
1 => t('Display each address component in a separate column'),
),
'#default_value' => $component['extra']['csv_separate'],
);
return $form;
}