I found one similar solution that almost does what I want.
DateTimePicker System.xml
I have implemented its code and was able to display a DateTime Picker
in my admin configuration. However, I would like to implement a Time Range Picker
but I don't need a UI component way of implementing it.
Best Answer
If you wish to add time from/to elements as a slider, you can customize an element frontend model and add your own template.
Here is my example (ported from the regular form to the store configuration section):
Field in the
system.xml
:Note: real values will be stored with the
delivery_time_from
anddelivery_time_to
indexes.Frontend model, where I have replaced the default output of the element:
here we just using a block
MageWorx\ExampleConfig\Block\TimeSlider
instead of general render.And here is the block with template (where slider was defined):
Note: you should change values of the constants
TIME_NAME_FROM
andTIME_NAME_TO
to own ones, according your definition in thesystem.xml
.Template:
That's all. Based on this example you can modify code to add base features like a use global value etc.
Here is full code on the GitHub.
PS: Example partially taken from the Shipping Suite Ultimate Extension by MageWorx (where that kind of slider used in the form).
PPS: in the example time stored in the database in minutes, like 120 => 2:00 AM.