By default, prefix and suffix on an Bootstrap datetime picker element are hardcoded, and cannot be changed.
Element has the container as wrapper class and col-sm-6 as column class.
Any manually provided #prefix and #suffix will be ignored and overwritten.
In my opinion this is not a flexible solution, and developer must have a possibility to provide custom prefix and suffix.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | bootstrap_datetime_picker-prefix_suffix_hardcoded-3106036-05.patch | 979 bytes | fkatsukawa |
| #2 | bootstrap_datetime_picker-prefix_suffix_hardcoded-3106036.patch | 816 bytes | turtletrail |
Comments
Comment #2
turtletrail commentedHere is the patch that adds this possibility.
It's intended to not mess anything in the existing projects by providing the original prefix and suffix if none were provided manually.
Comment #3
digitalcatalyst commentedI confirm this patch solves the problem, when in a custom form, the hard coded prefix and suffix interfere with the layout. Manually removing from module makes the custom form layout perfect, but, edit a node which uses the datepicker, and this stops working.
Using the patch means setting #prefix=>'', #suffix=>'' on the custom form, layout works and the node edit still works.
Ive included my FAPI call in case there is another solution
$form['end_datetime'] = [
'#type' => 'bootstrap_date_time',
'#title' => 'Date/Time',
'#hour_format' => '24H',
'#allow_times' => '15',
'#disable_days' => [],
'#date_type' => 'datetime',
'#first_day' => 0,
'#default_value' => null !== $form_state->getValue('end_datetime'),
'#prefix' => '',
'#suffix' => ''
};
Comment #4
prashant.c@turtletrail
Please re-roll you patch using the changes in this issue https://www.drupal.org/project/bootstrap_datetime_picker/issues/3103343
or close this issue and put your changes combined in this issue as both are related ones.
Comment #5
fkatsukawaPatch re-rolled and tested.
Comment #8
fkatsukawaComment #9
fkatsukawa