Filter hooks

Developers can customise the behaviour of the plugin through filter hooks. There are some useful filter hooks supported by this plugin, and by Gravity Forms itself.

  • gf_address_enhanced_countries

    • array $countries
    • return array

    Developers can change the map of country names to codes.

  • gf_address_enhanced_country_file

    • string $filepath
    • string $country_code
    • return string

    Developers can add their own country and state/province definitions, overriding those provided in the plugin. See the folder includes/countries/ for examples.

  • gf_address_enhanced_label_subdivisions_default

    • string $default_label
    • return string

    Developers can change the default label on state/province subfields.

  • gf_address_enhanced_layout

    • string $layout
    • int $form_id
    • GF_Field $field

    Developers can change the Address field layout to put the country subfield first, by returning ‘country_top’ from this filter. Supports hooking for all forms, by form ID, and by form ID and field ID per Gravity Forms conventions.

  • gf_address_enhanced_required_subfields

    • webaware\gf_address_enhanced\RequiredSubfields[] $map
    • return webaware\gf_address_enhanced\RequiredSubfields[]

    Developers can modify the required subfields by country, altering which countries require a city, state / province, or postal code.

  • gf_address_enhanced_smart_states_countries

    • array $countries
    • return array

    Developers can add or remove countries that should be supported for Smart States dropdowns.

  • gf_address_enhanced_state_name

    • string $name
    • string $country_code
    • string $state_code
    • string $original_name
    • return string

    Developers can change the names displayed for subdivisions (states, provinces).