[wp-trac] [WordPress Trac] #29324: Customizer Panels should have render_content to facilitate subclasses

WordPress Trac noreply at wordpress.org
Fri Aug 22 17:51:21 UTC 2014


#29324: Customizer Panels should have render_content to facilitate subclasses
------------------------------+-----------------------------
 Reporter:  celloexpressions  |      Owner:
     Type:  defect (bug)      |     Status:  new
 Priority:  normal            |  Milestone:  Awaiting Review
Component:  Customize         |    Version:  trunk
 Severity:  normal            |   Keywords:  has-patch
  Focuses:                    |
------------------------------+-----------------------------
 Like everything else in the Customizer, panels can be subclassed. This
 allows developers to override the behavior of a panel, or even to
 completely replace its contents with something other than controls or
 sections.

 Customizer Controls have two functions for rendering the control:
 `render`, which renders the control container markup with all of the
 classes and ids that controls should (almost) always have, and
 `render_content`, which renders the contents of the control markup. Most
 custom controls only need to override `render_content`, allowing the
 required core markup added by `render` to continue functioning without
 duplicating code.

 Panels should similarly use separate functions to render their containers
 and their contents. The container, in this case, would be the panel title
 in the top-level controls, the back button, and the container for the
 different control sections that would normally be added to a panel. The
 contents would be the in-panel panel heading (section that says "you are
 customizing..." and has the description as its contents) and the code that
 renders all sections in the panel.

 It doesn't really make sense to do this with sections, as the contents
 consists only of controls, and custom controls can be created to
 completely alter the contents of sections. But we should add it to panels,
 where it may be necessary to do things differently in some instances.

 While it would be best if this were in 4.0, I think it should actually be
 back-compat if we introduce it in 4.1, as anyone overriding the panel's
 contents would have been overriding the `render` function, so they
 wouldn't be calling `render_content` anyway.

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


More information about the wp-trac mailing list