WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 17 months ago

#17298 new feature request

Adding optional "fieldname_base" parameter to touch_time() function would allow plugin authors to reuse this code

Reported by: goldenapples Owned by:
Priority: normal Milestone: Awaiting Review
Component: General Version:
Severity: trivial Keywords:
Cc: goldenapplesdesign@…, ericjuden@…

Description

I didn't see any discussion of this over the years, and wondered if this was a feature that other people would like to see added:

In a couple projects, I've had to recreate a date entry form very similar to the one generated by the touch_time() function in wp-admin/includes/template.php. This function could be modified very easily to be reusable in plugins.

The simplest way of doing this, in my opinion, is to accept an optional fifth parameter for a fieldname base string.

Current output of the function:

<select id="mm" name="mm" tabindex="4">
// options
</select>
// etc

If this could be modified by a plugin to output something like this:

<select id="eventstartdate_mm" name="eventstartdate[mm]" tabindex="4">
// options
</select>
// etc

...it would be very useful. Would improve standardization of UI elements between core and plugins.

Of course, the entire template.php file is A Big Mess. Not sure if we should be messing around in there too much.


Attachments (1)

17298-patch.patch (206.2 KB) - added by ericjuden 17 months ago.
17298-patch

Download all attachments as: .zip

Change History (4)

comment:1 scribu2 years ago

touch_time() is not the ideal date input method. See #7665 and #11942

comment:2 ericjuden17 months ago

I would love to see this in there too! It would be easy enough to add another optional parameter and it would open this up to developers.

comment:3 ericjuden17 months ago

  • Cc ericjuden@… added

ericjuden17 months ago

17298-patch

Note: See TracTickets for help on using tickets.