Opened 3 years ago

Closed 17 months ago

Last modified 17 months ago

#11611 closed enhancement (fixed)

Allow pluggable arg checking in current_theme_supports

Reported by: hakre Owned by: ryan
Priority: normal Milestone: 3.4
Component: Themes Version: 2.9
Severity: normal Keywords: has-patch 3.2-early
Cc:

Description

There is an @todo task left in the file wp-includes/theme.php inside the current_theme_supports function. The original author should decide wether or not he wants to implement the noted feature or to just drop it.

From other code I've seen today, it's commong to check $args[0] for being an array and if so to set $args =& $arg[0];

Attachments (3)

11611.diff (730 bytes) - added by dd32 3 years ago.
11611.2.diff (601 bytes) - added by ryan 17 months ago.
Per duck_'s comment
11611-unit.diff (1.0 KB) - added by ryan 17 months ago.
Unit tests

Download all attachments as: .zip

Change History (15)

dd323 years ago

comment:1 follow-up: ↓ 2   dd323 years ago

  • Keywords dev-feedback has-patch added; developer-feedback removed

attachment 11611.diff added

  • My Take of how the pluggable support should be done.

comment:2 in reply to: ↑ 1   hakre3 years ago

Replying to dd32:

attachment 11611.diff added

  • My Take of how the pluggable support should be done.

I've read it in another way then. Can you just share two or three words what your patch is doing / should provide? I have problems to understand it.

The @todo tag was introduced in [12350] by ryan based on it's own (untested marked) code in #11364. Maybe ryan should explain the @todo tag.

comment:4   dd323 years ago

I've read it in another way then. Can you just share two or three words what your patch is doing / should provide? I have problems to understand it.

My understanding was, That for any features which accepts an array, There needed to be a filter to allow for plugins to take care of the array-based checking - As core only knows about how to handle the post-thumbnail array, Other features arrays may contain different data.

  • Milestone changed from 3.0 to 3.1
  • Type changed from defect (bug) to enhancement

Patch looks okay to me.

There are other issues in the theme support API we're not going to get to in 3.0, such as a more robust remove_theme_support() (#12739) that can handle multiple arguments. Moving to 3.1 for now.

  • Keywords dev-feedback removed
  • Milestone changed from Awaiting Triage to 3.1

comment:8   jane3 years ago

  • Keywords 3.2-early added
  • Milestone changed from 3.1 to Future Release

Missed the boat, entering beta. 3.2-early.

  • Keywords changed from has-patch, 3.2-early to has-patch 3.2-early

Pretty much how I was writing the patch before I double checked for an existing ticket.

However, I think moving the return apply_filters out of the switch statement would be better for readability. Having it as the default case makes the final return true; dead code and weird.

Related: #18691

Last edited 20 months ago by duck_ (previous) (diff)

ryan17 months ago

Per duck_'s comment

ryan17 months ago

Unit tests

  • Milestone changed from Future Release to 3.4
  • Owner set to ryan
  • Resolution set to fixed
  • Status changed from new to closed

In [19682]:

Allow pluggable arg checking in current_theme_supports. Props dd32. fixes #11611

Note: See TracTickets for help on using tickets.