Make WordPress Core

Opened 9 years ago

Closed 16 months ago

Last modified 15 months ago

#42635 closed enhancement (maybelater)

Customize: Add default value for customizeAction param for sections

Reported by: westonruter Owned by:
Priority: normal Milestone:
Component: Customize Version: 4.3
Severity: normal Keywords: needs-patch
Cc: Focuses:

Description

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 ​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
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' ) )
                )
        );
} );

Change History (3)

#1 @peterwilsoncc
8 years ago

  • Milestone 5.0 → Future Release

Switching milestone due to the focus on the new editor (Gutenberg) for WordPress 5.0.

#2 @westonruter
16 months ago

  • Resolution → maybelater
  • Status new → closed

#3 @desrosj
15 months ago

  • Milestone Future Release
Note: See TracTickets for help on using tickets.