I updated to Bootstrap 7.x-3.18 and it seems that Date fields that use the Date Select widget (which shows each date component as a dropdown select list) are no longer receiving the "form-control" class, so they are being rendered as dropdown selects using the browser's default styling.
I found this issue which changed the behavior of how that class is applied recently, so I assume this is what caused it #2804221: Elements that use core #theme hooks don't get .form-control applied.
Below are screenshots and markup snippets of the date fields before/after updating Bootstrap.
Before:

<div class="form-item form-item-timestamp-month form-type-select form-group">
<label class="control-label" for="edit-timestamp-month">Month <span class="form-required" title="This field is required.">*</span></label>
<div class="date-month">
<select class="date-month form-control form-select required" id="edit-timestamp-month" name="timestamp[month]">
<option value="1" selected="selected">Jan</option>
<option value="2">Feb</option>
<option value="3">Mar</option>
<option value="4">Apr</option>
<option value="5">May</option>
<option value="6">Jun</option>
<option value="7">Jul</option>
<option value="8">Aug</option>
<option value="9">Sep</option>
<option value="10">Oct</option>
<option value="11">Nov</option>
<option value="12">Dec</option>
</select>
</div>
</div>
After:

<div class="form-item form-item-timestamp-month form-type-select form-group">
<label class="control-label" for="edit-timestamp-month">Month <span class="form-required" title="This field is required.">*</span></label>
<div class="date-month">
<select class="date-month form-select required" id="edit-timestamp-month" name="timestamp[month]">
<option value="1" selected="selected">Jan</option>
<option value="2">Feb</option>
<option value="3">Mar</option>
<option value="4">Apr</option>
<option value="5">May</option>
<option value="6">Jun</option>
<option value="7">Jul</option>
<option value="8">Aug</option>
<option value="9">Sep</option>
<option value="10">Oct</option>
<option value="11">Nov</option>
<option value="12">Dec</option>
</select>
</div>
</div>
Notice how the <select> element has the class form-control in the before, but not in the after.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | 2939542-7.patch | 1.25 KB | markhalliwell |
Comments
Comment #2
m.stentaOops, uploaded the same screenshot twice. Fixed original description.
Comment #3
m.stentaOK I'm doing some debugging on this... see attached screenshot of Xdebug in PHPStorm...
The
ifstatement that adds theform-controlclass is not matching properly:In the case of a date select field,
$themeisdate_select_element(which does not exist in the$theme_hooksarray), and$typeisselect(which does not exist in the$typesarray), so neither satisfy the condition.I'm unsure what the correct way to fix this is, though... still understanding the logic in the
bootstrap_pre_render($element). Any guidance is appreciated! Happy to put together a patch while I've got the file open here...Comment #4
m.stentaOh, quick note about the screenshot in my last comment: you may notice that
date_select_elementis in the$typesarray. I added that earlier to see if it fixed it, so that doesn't actually exist in the current Bootstrap code.Comment #5
m.stentaIf I add
date_select_elementto the$theme_hooksarray, on the other hand, it fixes the issue. Attached is a simple one-line patch that demonstrates that.I do not think this is the right way to do it, though, based on how the rest of the code in that function is structured - it seems like
$theme_hooksis reserved for core theme functions, but$typesis used for contrib - is that right?Comment #6
m.stentaIt ALSO works if we just add
selectto the$typesarray (see attached patch) - but then it's duplicated in both$typesand$theme_hooks.Comment #7
markhalliwellHm. So when I was originally working on this in #2804221: Elements that use core #theme hooks don't get .form-control applied, I had actually merged the theme hooks into the types, but thought it wasn't needed.
I suppose this proves that it a
typemay actually be a normal core type, but thetheme hookimplementation was changed.Try this patch.
Comment #8
m.stentaYup that does the trick! Thanks!
Comment #10
markhalliwell