Changeset 60279
- Timestamp:
- 06/05/2025 08:43:08 AM (5 months ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
src/wp-includes/class-wp-customize-widgets.php (modified) (1 diff)
-
tests/phpunit/tests/customize/widgets.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-customize-widgets.php
r59676 r60279 922 922 <h3> 923 923 <span class="customize-action"> 924 <?php 924 <?php 925 $panel = $this->manager->get_panel( 'widgets' ); 926 $panel_title = $panel && isset( $panel->title ) ? $panel->title : __( 'Widgets' ); 925 927 /* translators: ▸ is the unicode right-pointing triangle. %s: Section title in the Customizer. */ 926 printf( __( 'Customizing ▸ %s' ), esc_html( $ this->manager->get_panel( 'widgets' )->title ) );927 ?>928 printf( __( 'Customizing ▸ %s' ), esc_html( $panel_title ) ); 929 ?> 928 930 </span> 929 931 <?php _e( 'Add a Widget' ); ?> -
trunk/tests/phpunit/tests/customize/widgets.php
r60253 r60279 873 873 $this->manager->widgets->remove_prepreview_filters(); 874 874 } 875 876 /** 877 * Test that output_widget_control_templates() works without sidebars. 878 * This test verifies that the fix for accessing panel title works correctly 879 * when no sidebars are registered or the widgets panel doesn't exist. 880 * 881 * @ticket 63151 882 * 883 * @covers WP_Customize_Widgets::output_widget_control_templates 884 */ 885 public function test_output_widget_control_templates_without_sidebars() { 886 global $wp_registered_sidebars; 887 888 $original_sidebars = $wp_registered_sidebars; 889 $wp_registered_sidebars = array(); 890 $manager = new WP_Customize_Manager(); 891 $widgets = new WP_Customize_Widgets( $manager ); 892 893 if ( $manager->get_panel( 'widgets' ) ) { 894 $manager->remove_panel( 'widgets' ); 895 } 896 897 ob_start(); 898 899 $widgets->output_widget_control_templates(); 900 901 $output = ob_get_clean(); 902 $wp_registered_sidebars = $original_sidebars; 903 904 $this->assertStringNotContainsString( 'Warning', $output, 'Failed asserting that the output does not contain "Warning".' ); 905 $this->assertStringNotContainsString( 'Notice', $output, 'Failed asserting that the output does not contain "Notice".' ); 906 $this->assertStringNotContainsString( 'Error', $output, 'Failed asserting that the output does not contain "Error".' ); 907 908 // Check that the output contains expected widget controls HTML. 909 $this->assertStringContainsString( 'id="widgets-left"', $output, 'Failed asserting that the output contains "id=widgets-left".' ); 910 $this->assertStringContainsString( 'id="available-widgets"', $output, 'Failed asserting that the output contains "id=available-widgets".' ); 911 $this->assertStringNotContainsString( 'id="accordion-panel-widgets"', $output, 'Failed asserting that the output does not contain "id=accordion-panel-widgets".' ); 912 } 875 913 }
Note: See TracChangeset
for help on using the changeset viewer.