Here is the address field for Spain

Comments

pcambra’s picture

StatusFileSize
new4.21 KB

Number shouldn't be required. Here is the correct patch.

EndEd’s picture

Works as expected!

pcambra’s picture

StatusFileSize
new5.77 KB

Forgot to add the tpl.php for the Spanish address
Here's the complete patch with the new git-like format.

pcambra’s picture

Status: Active » Needs review
Issue tags: -dcsprint5

Setting to CNR

damien tournoud’s picture

Status: Needs review » Closed (won't fix)

The -reloaded branch has been merged. It comes with reasonable defaults for most countries in the world, including Spain. This can be extended by contrib modules to provide the province-level dropdown.

pcambra’s picture

Status: Closed (won't fix) » Active

Hi Damien,

I've seen that some countries as Brazil, Italy, or US have their provinces dropdown included into the address.inc file, if I want to place Spanish provinces and other tweaks there do I need to add a independent module or can I attach a patch to be included in the address.inc of address field?

Thanks!

EndEd’s picture

Hi I'm also trying to add spanish provinces without any luck.

Any advise on this? Thanks in advance.

EDIT: Nevermind, sorry, I've just have success in adding my own plugin :)

chaloalvarezj’s picture

@EndEd.. Glad to read that you succeeded in creating your plugin.. could you please post here how you did it, as the module has no documentation on it?

I would appreciate it! thank you!

EndEd’s picture

Sorry chaloalvarezj for the delay.

For this to work you have to have the following folder structure in your custom module (of course all names can be changed):
..modules/my_module/my_module.info
..modules/my_module/my_module.module
..modules/my_module/plugins/format/es-address.inc

my_module.module

/**
 * Implements hook_ctools_plugin_directory().
 */
function x_address_es_ctools_plugin_directory($module, $plugin_type) {
  if ($module == 'addressfield' && $plugin_type == 'format') {
    return 'plugins/' . $plugin_type;
  }
}

es-address.inc

$plugin = array(
  'title' => t('Address form (ES add-on)'),
  'format callback' => 'MYMODULE_es_spanish_address_generate',
  'type' => 'address',
  'weight' => -99,
);

function MYMODULE_es_spanish_address_generate(&$format, $address, $context = array()) {
  if ($address['country'] == 'ES') {
    // Your modifications to the Spanish Addressfield.
    // You have to modify the $format variable as if it were a normal alter form.
  }
}

Hope this helps and it's not too late :)

EDIT: Also, as this is all about CTools, you should make your module dependent. This is my .info file:

name = CUSTOM Spanish Address Field
description = Custom module to implement the SPANISH addressfield format handler.
version = 7.x-1.0
core = 7.x

dependencies[] = ctools
dependencies[] = addressfield

files[] = my_module.module
pcambra’s picture

Status: Active » Fixed

I've created a sandbox so people can use spanish addressfield without coding http://drupal.org/sandbox/pcambra/1353366

This will be made obsolete by #1317070: Use ISO codes XML file for populating country-specific properties eventually.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.