User login |
Symfony forms - propel embedRelationUsing embedRelation in non English projects has an issue with texts. EmbedRelation method has a parameter 'title', this is used as label but also as a variable. 'empty_label' is also a label and a variable/function name. So both of the cant have spaces and dont make nice variable/function names if they have greek or other characters. The solution I found is to set them with nice english/latin names in the call of EmbedRelation and set the labels to what you like after using the widgetSchema's method setLabel. Look at the example: $this->embedRelation('Requirement', array( 'add_link' => '???', 'title' => 'Requirements', 'empty_label' => 'requirementt', ) ); $this->getWidgetSchema()->setLabel('Requirements', '??????????'); $ws = $this->getWidgetSchema('Requirements'); $ws['Requirements']->setLabel('requirementt', '???? ??????????'); You might notice the typo in 'requirementt', but it is a deliberate mistake. I have a field called requirement_type. The javascript that adds the new related form makes a regexp replacement in order to update the forms html with the id of the new form, and it changed my field's name also with the result to have an error 'there is an extra field in the form' and the form never worked. So this is an other point we should be aware.
|