WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 3 years ago

Last modified 3 years ago

#11611 closed enhancement (fixed)

Allow pluggable arg checking in current_theme_supports

Reported by: hakre Owned by: ryan
Milestone: 3.4 Priority: normal
Severity: normal Version: 2.9
Component: Themes Keywords: has-patch 3.2-early
Focuses: 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 5 years ago.
11611.2.diff (601 bytes) - added by ryan 3 years ago.
Per duck_'s comment
11611-unit.diff (1.0 KB) - added by ryan 3 years ago.
Unit tests

Download all attachments as: .zip

Change History (15)

@dd325 years ago

comment:1 follow-up: @dd325 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 @hakre5 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.

comment:3 @hakre5 years ago

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 @dd325 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.

comment:5 @nacin5 years ago

  • 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.

comment:6 @nacin5 years ago

  • Keywords dev-feedback removed

comment:7 @nacin5 years ago

  • Milestone changed from Awaiting Triage to 3.1

comment:8 @jane5 years ago

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

Missed the boat, entering beta. 3.2-early.

comment:9 @duck_4 years ago

  • 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.

Version 0, edited 4 years ago by duck_ (next)

@ryan3 years ago

Per duck_'s comment

@ryan3 years ago

Unit tests

comment:10 @ryan3 years ago

  • Milestone changed from Future Release to 3.4

comment:11 @ryan3 years ago

  • 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.