function currency_form_currency_exchanger in Currency 7.2
Implements form build callback: the currency exchanger overview form.
See also
theme_currency_form_currency_exchangers()
1 string reference to 'currency_form_currency_exchanger'
- currency_menu in currency/
currency.module - Implements hook_menu().
File
- currency/
currency.module, line 752 - Provides currency information and allows users to add custom currencies.
Code
function currency_form_currency_exchanger(array $form, array &$form_state) {
ctools_include('plugins');
$exchangers_info = ctools_get_plugins('currency', 'currency_exchanger');
$currency_exchangers = CurrencyExchanger::loadConfiguration();
$weight = 0;
foreach (array_keys($currency_exchangers) as $name) {
$exchanger_info = $exchangers_info[$name];
$form['exchangers']['#tree'] = TRUE;
$form['exchangers'][$name]['#tree'] = TRUE;
$form['exchangers'][$name]['enabled'] = array(
'#default_value' => $currency_exchangers[$name],
'#title' => t('Enabled'),
'#type' => 'checkbox',
);
$form['exchangers'][$name]['title'] = array(
'#description' => $exchanger_info['description'],
'#markup' => $exchanger_info['title'],
'#title' => t('Title'),
'#type' => 'item',
);
$form['exchangers'][$name]['weight'] = array(
'#default_value' => $weight++,
'#delta' => count($exchangers_info),
'#title' => t('Weight'),
'#type' => 'weight',
);
// @todo Convert this to a dropbutton in 8.x-3.x.
$form['exchangers'][$name]['operations'] = array(
'#markup' => theme('links', array(
'links' => $exchanger_info['exchanger']['class']::operationsLinks(),
'attributes' => array(
'class' => array(
'links',
'inline',
'operations',
),
),
)),
'#title' => t('Operations'),
'#type' => 'markup',
);
}
$form['actions'] = array(
'#type' => 'actions',
);
$form['actions']['save'] = array(
'#value' => t('Save'),
'#type' => 'submit',
);
return $form;
}