| 1 |
<?php |
<?php |
| 2 |
// $Id: addresses.inc,v 1.18 2008/07/31 11:20:16 brmassa Exp $ |
// $Id: addresses.inc,v 1.19 2008/07/31 11:26:51 brmassa Exp $ |
| 3 |
/** |
/** |
| 4 |
* @author Bruno Massa |
* @author Bruno Massa |
| 5 |
* @file addresses.inc |
* @file addresses.inc |
| 619 |
} |
} |
| 620 |
|
|
| 621 |
/** |
/** |
| 622 |
|
* Generate a settings form that will allow admins to choose |
| 623 |
|
* which addresses fields shuold be used. |
| 624 |
|
* |
| 625 |
|
* @param field_values |
| 626 |
|
* Array (optional). The default values for each field, if any |
| 627 |
|
* @return |
| 628 |
|
* Array. A form with settings |
| 629 |
|
* @ingroup form |
| 630 |
|
*/ |
| 631 |
|
function _addresses_settings($field_values = array()) { |
| 632 |
|
$ftypes = module_invoke_all('addressesfieldapi', 'fields'); |
| 633 |
|
foreach ($ftypes as $ftype => $field) { |
| 634 |
|
// List of address fields |
| 635 |
|
$form['addresses'][$ftype] = array( |
| 636 |
|
'#default_value' => empty($field_values[$ftype]) ? $field['display'] : $field_values[$ftype], |
| 637 |
|
'#options' => array( |
| 638 |
|
ADDRESSES_FIELD_NONE => '', |
| 639 |
|
ADDRESSES_FIELD_SHOW => '', |
| 640 |
|
ADDRESSES_FIELD_REQUIRED => '', |
| 641 |
|
ADDRESSES_FIELD_HIDDEN => '', |
| 642 |
|
), |
| 643 |
|
'#title' => $field['title'], |
| 644 |
|
'#type' => 'radios', |
| 645 |
|
); |
| 646 |
|
} |
| 647 |
|
|
| 648 |
|
$form['#theme'] = 'addresses_select_fields'; |
| 649 |
|
|
| 650 |
|
return $form; |
| 651 |
|
} |
| 652 |
|
|
| 653 |
|
/** |
| 654 |
* Generates HTML for the passed address. |
* Generates HTML for the passed address. |
| 655 |
* |
* |
| 656 |
* @ingroup themeable |
* @ingroup themeable |