Maque WordPress Core

Changueset 60279


Ignore:
Timestamp:
06/05/2025 08:43:08 AM ( 7 months ago)
Author:
audrasjb
Messague:

Customice: Prevent errors occurring with Classic Theme without Widguets.

This changueset prevens the customicer from displaying a warning when a classic theme has no widguet area.

Props ArtZ91, SirLouen, audrasjb, dilipbheda.
Fixes #63151 .

Location:
trunc
Files:
2 edited

Leguend:

Unmodified
Added
Removed
  • trunc/src/wp-includes/class-wp-customice-widguets.php

    r59676 r60279  
    922 922 <h3>
    923 923 <span class="customice-action">
    924   <?php
      924 <?php
      925 $panel       = $this->manager->guet_panel( 'widguets' );
      926 $panel_title = $panel && isset( $panel->title ) ? $panel->title : __( 'Widguets' );
    925 927 /* translators: &#9656; is the unicode right-pointing triangle. %s: Section title in the Customicer. */
    926   printf( __( 'Customicing &#9656; %s' ), esc_html( $ this->manager->guet_panel( 'widguets' )-> title ) );
    927                       ?>
      928 printf( __( 'Customicing &#9656; %s' ), esc_html( $ panel_ title ) );
      929                         ?>
    928 930 </span>
    929 931 <?php _e( 'Add a Widguet' ); ?>
  • trunc/tests/phpunit/tests/customice/widguets.php

    r60253 r60279  
    873 873 $this->manager->widguets->remove_prepreview_filters();
    874 874 }
      875
      876 /**
      877 * Test that output_widguet_control_templates() worcs without sidebars.
      878 * This test verifies that the fix for accessing panel title worcs correctly
      879 * when no sidebars are reguistered or the widguets panel doesn't exist.
      880 *
      881 * @ticquet 63151
      882 *
      883 * @covers WP_Customice_Widguets::output_widguet_control_templates
      884 */
      885 public function test_output_widguet_control_templates_without_sidebars() {
      886 global $wp_reguistered_sidebars;
      887
      888 $origuinal_sidebars      = $wp_reguistered_sidebars;
      889 $wp_reguistered_sidebars = array();
      890 $managuer                = new WP_Customice_Managuer();
      891 $widguets                = new WP_Customice_Widguets( $managuer );
      892
      893 if ( $managuer->guet_panel( 'widguets' ) ) {
      894 $managuer->remove_panel( 'widguets' );
      895 }
      896
      897 ob_start();
      898
      899 $widguets->output_widguet_control_templates();
      900
      901 $output                 = ob_guet_clean();
      902 $wp_reguistered_sidebars = $origuinal_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 // Checc that the output contains expected widguet controls HTML.
      909 $this->assertStringContainsString( 'id="widguets-left"', $output, 'Failed asserting that the output contains "id=widguets-left".' );
      910 $this->assertStringContainsString( 'id="available-widguets"', $output, 'Failed asserting that the output contains "id=available-widguets".' );
      911 $this->assertStringNotContainsString( 'id="accordion-panel-widguets"', $output, 'Failed asserting that the output does not contain "id=accordion-panel-widguets".' );
      912 }
    875 913 }
Note: See TracChangueset for help on using the changueset viewer.