[wp-trac] [WordPress Trac] #20110: Add a valued() function to encourage consistency in input fields

WordPress Trac wp-trac at lists.automattic.com
Fri Feb 24 20:11:17 UTC 2012


#20110: Add a valued() function to encourage consistency in input fields
-----------------------------------+------------------------------
 Reporter:  jeremyfelt             |       Owner:
     Type:  enhancement            |      Status:  new
 Priority:  normal                 |   Milestone:  Awaiting Review
Component:  Template               |     Version:
 Severity:  normal                 |  Resolution:
 Keywords:  has-patch 2nd-opinion  |
-----------------------------------+------------------------------

Comment (by nacin):

 > You get +100 psychic points if you can guess what those two false values
 represent, without looking at the definition.

 I know that one controls <p> tags being wrapped or not, but I didn't know
 which. It turns out the other one is the name attribute.

 > That could be the case with many functions. I think the true/false for
 echo/return works here.

 This works sometimes, but it
 [http://codex.wordpress.org/WordPress_Coding_Standards#Self-
 Explanatory_Flag_Values_for_Function_Arguments gets old really quick].

 In fairness, valued()'s third argument is the same as the third argument
 for checked() and selected() — whether to echo. Unfortunately, the first
 and second arguments do not have parity. In checked(), selected(), and
 disabled(), the values are compared to ascertain whether to issue the
 corresponding selector. They are designed to help with loops because the
 code gets messy here quick.

 Not to pick at a function name itself, but neither attribute is called
 valued, while they are called checked, selected, and disabled. All three
 of those are also boolean attributes that control the input state, not
 something that requires a value.

 If we are to consider a valued() function, we might as well just have an
 input() function that serves up the whole element. Generally, I think HTML
 is enough of an "API" all on its own.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/20110#comment:13>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list