realbig / rbm-field-helpers

0 stars 1 forks source link

Automatically Enqueue Scripts for Datepicker, Timepicker, and Datetimepicker fields #50

Closed d4mation closed 6 years ago

d4mation commented 6 years ago

This one is a little tricky, only because it is removing a Filter. But that shouldn't matter since running code on non-existent Actions and Filters doesn't harm anything.

With RBM FH v1.4.0 (First release of the new submodule method), a Filter called rbm_fieldhelpers_load_datetimepicker was introduced to Enable loading these scripts automatically whether a necessary Field was being used or not.

Now these Fields instead enqueue the necessary scripts only when actually needed, similar to the WYSIWYG option for Textarea Fields. They'll only enqueue once, so there's no danger in doing it this way.

d4mation commented 6 years ago

This relates to #49

d4mation commented 6 years ago

I thought I had requested review on this one. My bad!

joelworsham commented 6 years ago

And you're 100% certain that enqueing it this late in the WP load cycle is OK?

d4mation commented 6 years ago

I am fairly certain. It is the exact same thing we're doing with the Textarea Field for WYSIWYGs.

I tested it for each field and it all works as expected.