[wp-trac] [WordPress Trac] #17851: Wrapping Sections with add_settings_section

WordPress Trac noreply at wordpress.org
Tue Sep 20 09:57:58 UTC 2022


#17851: Wrapping Sections with add_settings_section
-------------------------------------------------+-------------------------
 Reporter:  griffinjt                            |       Owner:  audrasjb
     Type:  enhancement                          |      Status:  closed
 Priority:  normal                               |   Milestone:  6.1
Component:  Administration                       |     Version:  3.1.3
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  has-patch good-first-bug has-unit-   |     Focuses:
  tests needs-dev-note commit                    |
-------------------------------------------------+-------------------------
Changes (by audrasjb):

 * status:  accepted => closed
 * resolution:   => fixed


Comment:

 In [changeset:"54247" 54247]:
 {{{
 #!CommitTicketReference repository="" revision="54247"
 Administration: Allow to wrap Settings sections with custom HTML content.

 This changeset improves the `add_settings_section()` function to allow
 developers to pass extra HTML mark-up to be rendered before and after the
 settings section. Extra argument `$args` can now be passed to the
 function, and is an array that can contain the following items:

 - `before_section`: HTML content to prepend to the section's HTML output.
 Receives the section's class name provided with the `section_class`
 argument via an optional `%s` placeholder. Default empty.
 - `after_section`: HTML content to append to the section's HTML output.
 Default empty.
 - `section_class`: The class name to use for the section. Used by
 `before_section` if a `%s` placeholder is present. Default empty.

 The HTML passed using these extra arguments is escaped using
 `wp_kses_post()` just before rendering. This changeset also provides a set
 of unit tests for this new feature.

 Props griffinjt, nacin, scribu, ross_ritchey, ryan, chriscct7, palmiak,
 rehanali, costdev, martinkrcho, chaion07, audrasjb, hellofromtonya.
 Fixes #17851.
 }}}

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


More information about the wp-trac mailing list