{"action":"opened","issue":{"url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/issues/1336","repository_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle","labels_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/issues/1336/labels{/name}","comments_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/issues/1336/comments","events_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/issues/1336/events","html_url":"https://github.com/javiereguiluz/EasyAdminBundle/issues/1336","id":183566195,"number":1336,"title":"Easy customization for form_group_class per field in bootstrap layout","user":{"login":"shakaran","id":14254,"avatar_url":"https://avatars.githubusercontent.com/u/14254?v=3","gravatar_id":"","url":"https://api.github.com/users/shakaran","html_url":"https://github.com/shakaran","followers_url":"https://api.github.com/users/shakaran/followers","following_url":"https://api.github.com/users/shakaran/following{/other_user}","gists_url":"https://api.github.com/users/shakaran/gists{/gist_id}","starred_url":"https://api.github.com/users/shakaran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shakaran/subscriptions","organizations_url":"https://api.github.com/users/shakaran/orgs","repos_url":"https://api.github.com/users/shakaran/repos","events_url":"https://api.github.com/users/shakaran/events{/privacy}","received_events_url":"https://api.github.com/users/shakaran/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-10-18T01:08:09Z","updated_at":"2016-10-18T01:08:09Z","closed_at":null,"body":"In the boostrap layout you can see [in this line](https://github.com/javiereguiluz/EasyAdminBundle/blob/master/Resources/views/form/bootstrap_3_horizontal_layout.html.twig#L31) how the form-group is created for every field.\r\n\r\nit is easy to configure the layout for the \"label\" field in each type of field, but it is \"hardcoded\" for change the layout in the \"body\" fields. For example this config:\r\n\r\n    - { property: 'name', label: 'My name', type: 'text', css_class: 'col-sm-2', type_options: { attr: {'class': 'col-sm-3 ', 'style': 'background-color:#f9f4d1'}, required: false } }\r\n\r\nWill generate something like:\r\n\r\n\t<div class=\"col-xs-12 col-sm-2\">\r\n\t\t<div class=\"form-group field-input\">\r\n\t\t\t<label class=\"col-sm-3 control-label\" for=\"name\">My name</label>\r\n\t\t\t<div class=\"col-sm-10\">\r\n\t\t\t\t<input type=\"text\" style=\"background-color:#f9f4d1\" id=\"name\" name=\"name\" class=\"form-control col-sm-3\">\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t</div>\r\n\r\nAs you can see, the problem is trying to change \"col-sm-10\" in <div class=\"{{ block('form_group_class') }}\"> that only could be overwritten if you overwrite the entire layout .twig.html for bootstrap_3_horizontal_layout.html.twig, because it is very common, that you could get long labels and they are streched because the col-sm-10 probably should be reduced in favor of the label width layout.\r\n\r\nWhat I am purposing is something like:\r\n\r\n    {% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ block('form_label_class'))|trim}) %}\r\n\r\nBut in this part:\r\n\r\n    <div class=\"{{ block('form_group_class') }}\">\r\n\r\nIf I will have the knowledge to make a PR, I will do it, but I don't know how to rewrite this properly for a twig block and implement a attribute per field, maybe form_group_class?"}}
{"actor":{"display_login":"shakaran"}}