Ticket #34747: b2088ce.diff
File b2088ce.diff, 9.3 KB (added by , 9 years ago) |
---|
-
src/wp-admin/css/customize-controls.css
diff --git src/wp-admin/css/customize-controls.css src/wp-admin/css/customize-controls.css index 1a2d346..00e3e71 100644
h3.customize-section-title { 418 418 transition: left ease-in-out .18s; 419 419 } 420 420 421 #customize-info.no-title { 422 display:none; 423 } 424 421 425 .ios #customize-info, 422 426 .ios #customize-theme-controls > ul > .accordion-section { 423 427 -webkit-transition: left 0s; -
src/wp-admin/customize.php
diff --git src/wp-admin/customize.php src/wp-admin/customize.php index 7f667d3..be5e81d 100644
do_action( 'customize_controls_print_scripts' ); 132 132 <div id="customize-info" class="accordion-section customize-info"> 133 133 <div class="accordion-section-title"> 134 134 <span class="preview-notice"><?php 135 echo sprintf( __( 'You are customizing %s' ), '<strong class="panel-title site-title">' . get_bloginfo( 'name') . '</strong>' );135 echo sprintf( __( 'You are customizing %s' ), '<strong class="panel-title site-title">' . $wp_customize->get_root_panel_title() . '</strong>' ); 136 136 ?></span> 137 <button class="customize-help-toggle dashicons dashicons-editor-help" aria-expanded="false"><span class="screen-reader-text"><?php _e( 'Help' ); ?></span></button> 137 <?php 138 $root_panel_description = $wp_customize->get_root_panel_description(); 139 if ( ! empty ( $root_panel_description ) ): 140 ?> 141 <button class="customize-help-toggle dashicons dashicons-editor-help" aria-expanded="false"><span class="screen-reader-text"><?php _e( 'Help' ); ?></span></button> 142 <?php endif; ?> 143 </div> 144 <div class="customize-panel-description"> 145 <?php echo $root_panel_description; ?> 138 146 </div> 139 <div class="customize-panel-description"><?php140 _e( 'The Customizer allows you to preview changes to your site before publishing them. You can also navigate to different pages on your site to preview them.' );141 ?></div>142 147 </div> 143 148 144 149 <div id="customize-theme-controls"> -
src/wp-admin/js/customize-controls.js
diff --git src/wp-admin/js/customize-controls.js src/wp-admin/js/customize-controls.js index e1021a3..d2c1e7c 100644
3250 3250 }); 3251 3251 3252 3252 // Expand/Collapse the main customizer customize info. 3253 $( ' .customize-info' ).find( '> .accordion-section-title .customize-help-toggle' ).on( 'click keydown', function( event ) {3253 $( '#customize-info > .accordion-section-title .customize-help-toggle' ).on( 'click keydown', function( event ) { 3254 3254 if ( api.utils.isKeydownButNotEnterEvent( event ) ) { 3255 3255 return; 3256 3256 } … … 3654 3654 } ); 3655 3655 3656 3656 // Bind site title display to the corresponding field. 3657 if ( title.length ) { 3658 api( 'blogname', function( setting ) { 3659 var updateTitle = function() { 3657 api( 'blogname', function( setting ) { 3658 var updateTitle = function() { 3659 3660 // Set the Customizer title. 3661 if ( api.settings.isRootPanelTitleOverridden ) { 3662 title.text( api.settings.filteredRootPanelTitle || '' ); 3663 } else { 3660 3664 title.text( $.trim( setting() ) || api.l10n.untitledBlogName ); 3661 }; 3662 setting.bind( updateTitle ); 3663 updateTitle(); 3664 } ); 3665 } 3665 } 3666 3667 // If there's no title, set a class on the info section. The CSS will hide it. 3668 if ( ! title.text().length ) { 3669 $( '#customize-info' ).addClass( 'no-title' ); 3670 } else { 3671 $( '#customize-info' ).removeClass( 'no-title' ); 3672 } 3673 3674 }; 3675 setting.bind( updateTitle ); 3676 updateTitle(); 3677 } ); 3666 3678 3667 3679 /* 3668 3680 * Create a postMessage connection with a parent frame, -
src/wp-includes/class-wp-customize-manager.php
diff --git src/wp-includes/class-wp-customize-manager.php src/wp-includes/class-wp-customize-manager.php index ffc3ca5..850f156 100644
final class WP_Customize_Manager { 184 184 protected $return_url; 185 185 186 186 /** 187 * Title of the Customizer, shown in the top of the root panel. 188 * 189 * @since 4.6 190 * @access protected 191 * @var string 192 */ 193 protected $root_panel_title; 194 195 /** 196 * Description of the Customizer, below the title. 197 * 198 * @since 4.6 199 * @access protected 200 * @var string 201 */ 202 protected $root_panel_description; 203 204 /** 187 205 * Mapping of 'panel', 'section', 'control' to the ID which should be autofocused. 188 206 * 189 207 * @since 4.4.0 … … final class WP_Customize_Manager { 1601 1619 } 1602 1620 1603 1621 /** 1622 * Set Customizer title at top of root Customizer panel. 1623 * 1624 * Appears after text "You are customizing." 1625 * 1626 * @since 4.6 1627 * @access public 1628 * @param string $root_panel_title Appears above description. 1629 */ 1630 public function set_root_panel_title( $root_panel_title ) { 1631 $this->root_panel_title = $root_panel_title; 1632 } 1633 1634 /** 1635 * Get Customizer title at top of root Customizer panel 1636 * 1637 * Appears above the description. 1638 * 1639 * @since 4.6 1640 * @access public 1641 * 1642 * @return string Root panel title. 1643 */ 1644 public function get_root_panel_title() { 1645 return is_null( $this->root_panel_title ) ? get_bloginfo( 'name' ) : $this->root_panel_title; 1646 } 1647 1648 /** 1649 * Set Customizer description. 1650 * 1651 * To be shown at the top of the Customizer root panel. 1652 * 1653 * @since 4.6 1654 * @access public 1655 * @param string $root_panel_description Appears after Customizer title. 1656 */ 1657 public function set_root_panel_description( $root_panel_description ) { 1658 $this->root_panel_description = $root_panel_description; 1659 } 1660 1661 /** 1662 * Get Customizer description, to be shown in the root panel. 1663 * 1664 * Appears after "You are customizing" and the Customizer title. 1665 * 1666 * @since 4.6 1667 * @access public 1668 * 1669 * @return string Root panel description. 1670 */ 1671 public function get_root_panel_description() { 1672 $default_description = __( 'The Customizer allows you to preview changes to your site before publishing them. You can also navigate to different pages on your site to preview them.' ); 1673 return is_null( $this->root_panel_description ) ? $default_description : $this->root_panel_description; 1674 } 1675 1676 /** 1604 1677 * Set the autofocused constructs. 1605 1678 * 1606 1679 * @since 4.4.0 … … final class WP_Customize_Manager { 1727 1800 'documentTitleTmpl' => $this->get_document_title_template(), 1728 1801 'previewableDevices' => $this->get_previewable_devices(), 1729 1802 'selectiveRefreshEnabled' => isset( $this->selective_refresh ), 1803 'filteredRootPanelTitle' => $this->get_root_panel_title(), 1804 'isRootPanelTitleOverridden' => ! is_null( $this->root_panel_title ), 1730 1805 ); 1731 1806 1732 1807 // Prepare Customize Section objects to pass to JavaScript. -
tests/phpunit/tests/customize/manager.php
diff --git tests/phpunit/tests/customize/manager.php tests/phpunit/tests/customize/manager.php index 6f5789d..a6ff1ea 100644
class Tests_WP_Customize_Manager extends WP_UnitTestCase { 340 340 } 341 341 342 342 /** 343 * Test get_root_panel_title()/set_root_panel_title() methods. 344 * 345 * @see WP_Customize_Manager::get_root_panel_title(); 346 * @see WP_Customize_Manager::set_root_panel_title(); 347 */ 348 function test_get_root_panel_title() { 349 $this->assertEquals( get_bloginfo( 'name' ), $this->manager->get_root_panel_title() ); 350 351 $first_new_title = 'Different Title'; 352 $this->manager->set_root_panel_title( $first_new_title ); 353 $this->assertEquals( $first_new_title, $this->manager->get_root_panel_title() ); 354 355 $second_new_title = 'Renamed Title'; 356 $this->manager->set_root_panel_title( $second_new_title ); 357 $this->assertEquals( $second_new_title, $this->manager->get_root_panel_title() ); 358 } 359 360 /** 361 * Test get_root_panel_description()/set_root_panel_description() methods. 362 * 363 * @see WP_Customize_Manager::get_root_panel_title(); 364 * @see WP_Customize_Manager::set_root_panel_title(); 365 */ 366 function test_get_root_panel_description() { 367 $default_description = __( 'The Customizer allows you to preview changes to your site before publishing them. You can also navigate to different pages on your site to preview them.' ); 368 $this->assertEquals( $default_description, $this->manager->get_root_panel_description() ); 369 370 $first_new_description = 'Another Description'; 371 $this->manager->set_root_panel_description( $first_new_description ); 372 $this->assertEquals( $first_new_description, $this->manager->get_root_panel_description() ); 373 374 $second_new_description = '<em>Newest Description</em>'; 375 $this->manager->set_root_panel_description( $second_new_description ); 376 $this->assertEquals( $second_new_description, $this->manager->get_root_panel_description() ); 377 } 378 379 /** 343 380 * Test get_autofocus()/set_autofocus() methods. 344 381 * 345 382 * @see WP_Customize_Manager::get_autofocus() … … class Tests_WP_Customize_Manager extends WP_UnitTestCase { 425 462 $data = json_decode( $json, true ); 426 463 $this->assertNotEmpty( $data ); 427 464 428 $this->assertEqualSets( array( 'theme', 'url', 'browser', 'panels', 'sections', 'nonce', 'autofocus', 'documentTitleTmpl', 'previewableDevices', 'selectiveRefreshEnabled' ), array_keys( $data ) );465 $this->assertEqualSets( array( 'theme', 'url', 'browser', 'panels', 'sections', 'nonce', 'autofocus', 'documentTitleTmpl', 'previewableDevices', 'selectiveRefreshEnabled', 'filteredRootPanelTitle', 'isRootPanelTitleOverridden' ), array_keys( $data ) ); 429 466 $this->assertEquals( $autofocus, $data['autofocus'] ); 430 467 $this->assertArrayHasKey( 'save', $data['nonce'] ); 431 468 $this->assertArrayHasKey( 'preview', $data['nonce'] );