[wp-trac] [WordPress Trac] #11433: Add 'id' argument to wp_dropdown_pages to match 'name' (needed for use in widget settings)
WordPress Trac
wp-trac at lists.automattic.com
Mon Dec 14 17:58:13 UTC 2009
#11433: Add 'id' argument to wp_dropdown_pages to match 'name' (needed for use in
widget settings)
--------------------------+-------------------------------------------------
Reporter: jeremyclarke | Owner: jeremyclarke
Type: defect (bug) | Status: new
Priority: normal | Milestone: 3.0
Component: General | Version: 2.9
Severity: normal | Keywords: has-patch needs-testing
--------------------------+-------------------------------------------------
Comment(by jeremyclarke):
I just updated the attachment to reflect #wordpress-dev feedback from
filosofo.
The original patch set {{{$id}}} as 'page_id' in {{{$defaults}}} along
with {{{$name}}} (which ensures back-compat with people who didn't set a
{{{$name }}} argument). Filosofo pointed out that if someone had used the
old {{{$name}}} argument and then styled/javascripted the resulting
{{{<select>}}} based on the assumption that {{{$name }}} would also
control the {{{#id}}}, my patch would break their code, because the id
would now be 'page_id' rather their their {{{$name}}} parameter.
The new patch instead sets {{{'id' => ''}}} in the {{{$defaults}}}
definition, then later, IF there was no id parameter passed in, it sets
{{{$id = $name}}}. This way the ID will work but only if its explicitly
set.
IMHO this is not the ideal solution because it is a strange and
idiosyncratic behavior, but in the name of backwards-compatibility it is
probably safer to go with this. If there is a committer who would rather
have an elegant {{{wp_dropdown_pages()}}} than a 100% back-compat then
feel free to switch it back to the other way. Since $_POST is controlled
by 'name' and not 'id' it seems that most uses of
{{{wp_dropdown_pages()}}} would not be effected by either patch.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/11433#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list