How to use Locale::getDefault()
for country field or in choice field with country names?
I have tried ->add('agentCity','country')
but I don't know how to use Locale::getDefault()
You can easily create a dropdown list of languages using the language
field type: http://symfony.com/doc/current/reference/forms/types/language.html.
Then you can specify the default value using empty_data
, assuming that Locale::getDefault()
is in the languages list:
$form->add('agentCity', 'language', array('empty_data' => Locale::getDefault()));