Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Easy customization for form_group_class per field in bootstrap layout #1336

Closed
shakaran opened this issue Oct 18, 2016 · 1 comment
Closed
Labels

Comments

@shakaran
Copy link
Contributor

In the boostrap layout you can see in this line how the form-group is created for every field.

it 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:

- { 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 } }

Will generate something like:

<div class="col-xs-12 col-sm-2">
    <div class="form-group field-input">
        <label class="col-sm-3 control-label" for="name">My name</label>
        <div class="col-sm-10">
            <input type="text" style="background-color:#f9f4d1" id="name" name="name" class="form-control col-sm-3">
        </div>
    </div>
</div>

As you can see, the problem is trying to change "col-sm-10" in

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.

What I am purposing is something like:

{% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ block('form_label_class'))|trim}) %}

But in this part:

<div class="{{ block('form_group_class') }}">

If 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?

@javiereguiluz
Copy link
Collaborator

I'm closing this issue because we're starting a new phase in the history of this bundle (see #2059). We've moved it into a new GitHub organization and we need to start from scratch: no past issues, no pending pull requests, etc.

I understand if you are angry or disappointed by this, but we really need to "reset" everything in order to reignite the development of this bundle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants