You are here

function example_address_country_admin_form in Countries 8

Same name and namespace in other branches
  1. 7.2 modules/countries_configuration/countries_configuration.api.php \example_address_country_admin_form()

An example form callback provided by hook_countries_configuration_options().

Parameters

object $country: The country that is being edited.

array $values: The existing values from the database or from the default settings.

array $form: A reference to the base form if required. You can use this to append your own form data that is not maintained by this module. You will of course need to provide submit handles, et al, to maintain this data yourself.

Return value

array The form structure of the additional form fields.

1 string reference to 'example_address_country_admin_form'
hook_countries_configuration_options in modules/countries_configuration/countries_configuration.api.php
Form settings for integrating with the countries configuration module.

File

modules/countries_configuration/countries_configuration.api.php, line 84
An overview of the hooks that this module provides.

Code

function example_address_country_admin_form($country, $values, &$form) {
  foreach (address_field_components() as $key => $info) {
    $form['labels'][$key] = array(
      '#type' => 'textfield',
      '#title' => t('Label for @title', array(
        '@title' => $info['name'],
      )),
      '#default_value' => $values['labels'][$key],
    );
  }
  return $form;
}