Reputation: 231
I generated a custom theme by copying
plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default"
into
plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/mytheme1"
I changed the templates to match my needs (no tables, custom errors display and so on).
./symfony doctrine:generate-module --theme=mytheme1 frontend user User
works as I expected however if I add
$this->embedI18n(array('en','fr'));
to the form class the generator renders the I18n embedded form with and .
Where do this come from? How can I customize it? where are the template files for i18n embedded forms located?
Thanks a lot, Massimo
Upvotes: 0
Views: 1416
Reputation: 412
The template is defined in the formatter of the widgetSchema of your i18n form. By default, it is set to sfWidgetFormSchemaFormatterTable which contains the definition of what you are looking for :
class sfWidgetFormSchemaFormatterTable extends sfWidgetFormSchemaFormatter
{
protected
$rowFormat = "<tr>\n <th>%label%</th>\n <td>%error%%field%%help%%hidden_fields%</td>\n</tr>\n",
$errorRowFormat = "<tr><td colspan=\"2\">\n%errors%</td></tr>\n",
$helpFormat = '<br />%help%',
$decoratorFormat = "<table>\n %content%</table>";
}
You can change this by editing your i18n form class initialization. For example, if you want to display the fields in a list :
public function setup()
{
parent::setup();
$formatter = new sfWidgetFormSchemaFormatterList($this->getWidgetSchema());
$this->getWidgetSchema()->addFormFormatter('list', $formatter);
$this->getWidgetSchema()->setFormFormatterName('list');
}
You can also define your own formatter inheriting from sfWidgetFormSchemaFormatter to match your layout preferences.
Upvotes: 1
Reputation: 36231
Firstly it's not the best idea to overload a theme in the plugin itself. Plugin's shouldn't be touched to allow future updates. You can easily overload the theme in your application.
Secondly something seems to be missing in your post: "to the form class the generator renders the I18n embedded form with and ."
Maybe missing translation indicators are shown?
Upvotes: 1