Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
The suggested field templates are very useful to clean the Drupal HTML markup.
For example I use "Minimal" as the default one everywhere and build from there applying single field customisations.
I would like field templates, like the Minimal one, to be applicable to the forms as well.
Currently you can only use DS UI to move form fields around, but no markup customisation :(
Look at this single field (using the bootstrap based theme Radix):
<div class="field-type-commerce-price field-name-field-price field-widget-commerce-price-simple form-wrapper" id="edit-field-price">
<div id="field-price-add-more-wrapper">
<div class="form-item form-type-textfield form-item-field-price-und-0-amount form-group">
<label for="edit-field-price-und-0-amount">Prezzo <span class="form-required" title="This field is required.">*</span></label>
<input class="form-control form-text required" type="text" id="edit-field-price-und-0-amount" name="field_price[und][0][amount]" value="" size="10" maxlength="128"> <span class="field-suffix">EUR</span>
</div>
</div></div>
It could become this:
<div class="form-item-field-price-und-0-amount form-group">
<label for="edit-field-price-und-0-amount">Prezzo <span class="form-required" title="This field is required.">*</span></label>
<input class="form-control form-text required" type="text" id="edit-field-price-und-0-amount" name="field_price[und][0][amount]" value="" size="10" maxlength="128"> <span class="field-suffix">EUR</span>
</div>
Let alone the ability to apply custom CSS classes.. to make a form horizontal with Bootstrap for example :(
Comments
Comment #1
kopeboy CreditAttribution: kopeboy commentedComment #2
aspilicious CreditAttribution: aspilicious commentedWell unless someone can provide a patch, this is not going to happen.
It's really really hard to implement this, if it is possible.
And for D8 the ds forms module is gone as it is super seeded by "form modes".
Comment #3
aspilicious CreditAttribution: aspilicious commentedNobody will ever make a patch for this.
Have to close this for now...