WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 8 months ago

Last modified 8 months ago

#17298 closed enhancement (wontfix)

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

Reported by: goldenapples Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Administration Keywords:
Focuses: Cc:

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 2 years ago.
17298-patch

Download all attachments as: .zip

Change History (6)

comment:1 scribu3 years ago

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

comment:2 ericjuden2 years 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 ericjuden2 years ago

  • Cc ericjuden@… added

ericjuden2 years ago

17298-patch

comment:4 c3mdigital8 months ago

  • Resolution set to wontfix
  • Status changed from new to closed

See ui-datepicker discussionon #7665

comment:5 SergeyBiryukov8 months ago

  • Component changed from General to Administration
  • Milestone Awaiting Review deleted
  • Severity changed from trivial to normal
  • Type changed from feature request to enhancement
Note: See TracTickets for help on using tickets.