From ec7b39486e8d68860bc48eabde5758560250d833 Mon Sep 17 00:00:00 2001 From: Gustavo Martin Morcuende Date: Tue, 15 May 2012 19:08:14 +0200 Subject: [PATCH] Combobox to show the available languages. --- lib/form/doctrine/LanguageListForm.class.php | 37 ++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 lib/form/doctrine/LanguageListForm.class.php diff --git a/lib/form/doctrine/LanguageListForm.class.php b/lib/form/doctrine/LanguageListForm.class.php new file mode 100644 index 0000000..c2df827 --- /dev/null +++ b/lib/form/doctrine/LanguageListForm.class.php @@ -0,0 +1,37 @@ +useFields(array('id')); + + $this->widgetSchema['id'] = new sfWidgetFormDoctrineChoice(array('model' => $this->getModelName(), + 'add_empty' => false, + 'multiple' => false)); + + $this->validatorSchema['id'] = new sfValidatorDoctrineChoice(array('model' => $this->getModelName(), + 'required' => true, + 'multiple' => false)); + + $this->widgetSchema->setLabels(array('id' => 'Language: ',)); + + //i18n (Internationalization) + //See apps/companyfront/modules/language/i18n/language_select_form.es.xml file (not created yet) + $this->widgetSchema->getFormFormatter()->setTranslationCatalogue('language_select_form'); + + + //Every form must have its own name + $this->widgetSchema->setNameFormat('languageselect[%s]'); + } +} -- 2.1.4