Created
September 24, 2014 12:31
-
-
Save webdevilopers/f22c1b988bc452875934 to your computer and use it in GitHub Desktop.
Translating dynamic vars concatening object property in twig template using SonataAdminBundle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace Acme\DemoBundle\Admin; | |
| use Sonata\AdminBundle\Admin\Admin; | |
| use Sonata\AdminBundle\Datagrid\ListMapper; | |
| class ContractAdmin extends Admin | |
| { | |
| protected function configureListFields(ListMapper $listMapper) | |
| { | |
| $listMapper | |
| ->add('currentState', 'string', array( | |
| 'template' => 'AcmeDemoBundle:ContractAdmin:list__state.html.twig' | |
| )) | |
| ; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pending: Vorläufig | |
| in_progress: Läuft | |
| quote_submitted: Angebot erteilt | |
| contract_accepted: Auftrag erteilt | |
| contract_approved: Auftrag angenommen |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {% extends 'SonataAdminBundle:CRUD:base_list_field.html.twig' %} | |
| {% block field %} | |
| {{ ('contracts.states.'~object.currentState) | trans({}, 'ContractBundle')}} | |
| {% endblock %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment