Implement Country and Province dropdown list in drupal 7 programmatically using Location module

StackOverflow https://stackoverflow.com/questions/16270929

  •  13-04-2022
  •  | 
  •  

質問

I am implementing a Drupal 7 signup form (through a custom module) where users should be able to indicate their location (Country + Province/State) using dropdown lists. From the description of Location module, this seems possible (by using APIs or someother way). I am new to Drupal and have no idea of how to implement this in the custom module programatically (using location module's APIs). I've googled about this for a couple of days, but couldn't make much progress.

Any sample code or leads would be greatly appreciated.

Thanks a Ton.

役に立ちましたか?

解決 2

Ok I finally figured out how this is done. We just need to call the api function like here $country = array(location_get_provinces("us"));
This returns the provinces of the country which is supplied as a parameter.

他のヒント

If location module provides what you what, you should use it. Otherwise try with address field module.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top