[wp-trac] [WordPress Trac] #28746: Add class argument to add_settings_field()

WordPress Trac noreply at wordpress.org
Fri Jul 4 08:33:06 UTC 2014


#28746: Add class argument to add_settings_field()
--------------------------------------+-----------------------------
 Reporter:  euthelup                  |      Owner:
     Type:  feature request           |     Status:  new
 Priority:  normal                    |  Milestone:  Awaiting Review
Component:  Administration            |    Version:  trunk
 Severity:  normal                    |   Keywords:
  Focuses:  administration, template  |
--------------------------------------+-----------------------------
 Hello!

 I frequently find myself against this issue: I would like to control with
 javascript an entire option field and play with it but there is no way on
 making it unique.

 So I came here (for the first time) and kindly ask you if we can have
 class argument on  add_settings_field() function which should be put on
 the field's <tr> tag?

 Is not a tremendous work you could replicate the "label_for"
 functionality, instead of :
 {{{
                 echo '<tr>';
                 if ( !empty($field['args']['label_for']) )
                         echo '<th scope="row"><label for="' . esc_attr(
 $field['args']['label_for'] ) . '">' . $field['title'] . '</label></th>';
                 else
                         echo '<th scope="row">' . $field['title'] .
 '</th>';
 }}}

 it should be :
 {{{
                 if ( !empty($field['args']['class']) )
                         echo '<tr class="' . esc_attr(
 $field['args']['class'] ) . '">';
                 else
                         echo '<tr>';

                 if ( !empty($field['args']['label_for']) )
                         echo '<th scope="row"><label for="' . esc_attr(
 $field['args']['label_for'] ) . '">' . $field['title'] . '</label></th>';
                 else
                         echo '<th scope="row">' . $field['title'] .
 '</th>';
 }}}

 I still dream of the day when I can change myself the table markup to divs
 and spans but i guess it will remain a dream(and maybe this is not the
 topic to disqus that).

 P.S: my first ticket, sorry for anything i miss and take me slow.

 Best Regards,
 Andrei Lupu

--
Ticket URL: <https://core.trac.wordpress.org/ticket/28746>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list