/** 
  * @return string
  */
 private function _getCountryList()
 {
     $countries = $this->locationService->getActiveCountries();
     $result = array();
     foreach ($countries as $each) {
         $result[] = array('id' => $each['id'], 'custom_label' => "<span class='flag16 " . strtolower($each['ccIso']) . "'> </span> " . "<span class='item-label'>" . $each['name'] . "</span>", 'label' => $each['name']);
     }
     return \json_encode($result, JSON_HEX_APOS);
 }
 public function buildForm(FormBuilderInterface $builder, array $options = array())
 {
     $builder->addEventSubscriber(new ContactDetailDataSubscriber());
     $countryChoices = array();
     foreach ($this->locationService->getActiveCountries() as $country) {
         $code = (int) $country['countryCode'];
         $countryChoices[$country['id']] = $country['name'] . " (+{$code})";
     }
     $countryList = $builder->create('country', 'choice', array('label' => "Country", 'choices' => $countryChoices))->addModelTransformer(new CountryTransformer($this->locationService));
     $builder->add('type', 'hidden');
     $builder->add($countryList);
     $builder->add('area_code', 'text', array('required' => false, 'attr' => array('placeholder' => 'Area Code')));
     $builder->add('number', 'text', array('required' => false, 'attr' => array('placeholder' => 'Phone Number')));
     $builder->add('ext', 'text', array('required' => false));
     $builder->add('type', 'hidden', array('required' => false));
 }