[wp-trac] [WordPress Trac] #42635: Customize: Add default value for customizeAction param for sections

WordPress Trac noreply at wordpress.org
Mon Nov 20 05:30:22 UTC 2017


#42635: Customize: Add default value for customizeAction param for sections
-------------------------+-------------------------
 Reporter:  westonruter  |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  5.0
Component:  Customize    |    Version:  4.3
 Severity:  normal       |   Keywords:  needs-patch
  Focuses:               |
-------------------------+-------------------------
 Currently the `customizeAction` has to be explicitly provided when
 dynamically adding sections via JS. If not, then the section header has
 broken layout. There should be a default value provided so that this
 doesn't have to be provided each time (see #42083). Adding a default value
 for `customizeAction` is complicated a bit by the fact that it
 [https://github.com/WordPress/wordpress-
 develop/blob/4af1237176c326e7840361fd580fdc3f97841e6a/src/wp-includes
 /class-wp-customize-section.php#L228-L233 varies based on whether the
 section has a parent panel]. The `getContainer` method of
 `wp.customize.Section` probably should check if `customizeAction` is empty
 and if so supply one: it could look to see if it has a `panel` parent, and
 if so, grab the title; otherwise, it can use the default “Customizing”
 value. A default value should have been originally provided in #30737.

 Workaround for plugins to provide a default value in the mean time:

 {{{#!php
 <?php
 add_action( 'customize_controls_enqueue_scripts', function() {
         wp_add_inline_script(
                 'customize-controls',
                 sprintf(
 'wp.customize.Section.prototype.defaults.customizeAction = %s;',
                         wp_json_encode( __( 'Customizing' ) )
                 )
         );
 } );
 }}}

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


More information about the wp-trac mailing list