[wp-trac] [WordPress Trac] #42057: Add ability to pass a label for the <form> element returned by get_search_form()

WordPress Trac noreply at wordpress.org
Mon Oct 2 19:06:00 UTC 2017


#42057: Add ability to pass a label for the <form> element returned by
get_search_form()
---------------------------+------------------------------
 Reporter:  williampatton  |       Owner:
     Type:  enhancement    |      Status:  new
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  General        |     Version:  4.8.2
 Severity:  normal         |  Resolution:
 Keywords:                 |     Focuses:  accessibility
---------------------------+------------------------------

Comment (by williampatton):

 To confirm that the passed label (and any other args) would be available
 for use within a custom `searchform.php` file I created one in my test
 theme and placed some markup inside of it. I called the form manually like
 so:

 `get_search_form( array( 'label' => 'top nav search', ) );`

 At the top of the file I included code to print the list of available
 variables to debug log:

 `error_log( print_r( get_defined_vars(), true ), 0 );`.

 In my logs I see the list of variables available for use inside the
 `searchform.php` file and confirm that the passed `label` is available as
 part of the `$args` array.

 {{{
 [02-Oct-2017 18:58:25 UTC] Array
 (
     [args] => Array
         (
             [echo] => 1
             [label] => top nav search
         )

     [format] => html5
     [defaults] => Array
         (
             [echo] => 1
             [label] =>
         )

     [result] => Array
         (
             [echo] => 1
             [label] => top nav search
         )

     [search_form_template] => /var/www/html/wp-
 content/themes/testtheme/searchform.php
 )
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/42057#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list