Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Implements hook_field_widget_form_alter().
- */
- function MYMODULE_field_widget_form_alter(&$element, $form_state, $context) {
- if(!empty($element['#addressfield'])) {
- $element['country']['#weight'] = 100;
- }
- }
- /**
- * Implements hook_ctools_plugin_directory().
- */
- function MYMODULE_ctools_plugin_directory($module, $plugin) {
- if ($module == 'addressfield') {
- return 'plugins/' . $plugin;
- }
- }
- /**
- * Implements hook_ctools_plugin_type().
- */
- function MYMODULE_ctools_plugin_type() {
- $plugins['format'] = array(
- 'load themes' => TRUE,
- );
- return $plugins;
- }
- /**
- * @file
- * Move country field to the very end.
- */
- $plugin = array(
- 'title' => t('Alter addressfield'),
- 'format callback' => 'MYMODULE_format_address_alter_country',
- 'type' => 'address',
- 'weight' => -80,
- );
- /**
- * Format callback.
- *
- * @see CALLBACK_addressfield_format_callback()
- */
- function MYMODULE_format_address_alter_country(&$format, $address, $context = array()) {
- // Move country field to the very end.
- $format['country']['#weight'] = 100;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement