WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#9032 closed enhancement (fixed)

Two minor enhancements to checked() and selected()

Reported by: johnbillion Owned by: johnbillion
Milestone: 2.8 Priority: low
Severity: trivial Version: 2.7
Component: Template Keywords: has-patch
Focuses: Cc:

Description

The helper functions checked() and selected() compare two passed parameters and echo out their respective markup based on the result of the comparison.

Two improvements would be to give the second parameter a default value of true and to add an echo parameter, also with default value of true.

Attachments (2)

9032.patch (940 bytes) - added by johnbillion 5 years ago.
Patch
checked_sans_true.9032.diff (5.1 KB) - added by filosofo 5 years ago.

Download all attachments as: .zip

Change History (7)

johnbillion5 years ago

Patch

comment:1 johnbillion5 years ago

  • Keywords has-patch added

Patchy

comment:2 westi5 years ago

(In [10662]) Enhance checked and selected as well as consolidating code. See #9032 props johnbillion for the idea.

comment:3 follow-up: westi5 years ago

  • Cc westi added

Now we need a mega patch to rid ourselves of calling with true as the second argument ;-)

comment:4 in reply to: ↑ 3 filosofo5 years ago

Replying to westi:

Now we need a mega patch to rid ourselves of calling with true as the second argument ;-)

There you go, thanks to sed. Not too mega, either.

comment:5 westi5 years ago

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

(In [10670]) Don't pass defaulted argument to checked(). Fixes #9032 props filosofo.

Note: See TracTickets for help on using tickets.