Make WordPress Core


Ignore:
Timestamp:
07/24/2017 10:53:20 PM (7 years ago)
Author:
westonruter
Message:

Widgets: Rename Text widget's legacy mode to non-visual mode, restore boolean filter prop, and improve compatibility for widget_text filters applied in Custom HTML widget.

Merges [41132] onto 4.8 branch.
Amends [41050].
Props westonruter, obenland, timmydcrawford for testing.
See #35243, #40951, #40907.
Fixes #41394 for 4.8.1.

Location:
branches/4.8
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.8

  • branches/4.8/tests/phpunit/tests/widgets/custom-html-widget.php

    r41117 r41133  
    6060        );
    6161
     62        // Convert Custom HTML widget instance into Text widget instance data.
     63        $text_widget_instance = array_merge( $instance, array(
     64            'text' => $instance['content'],
     65            'filter' => false,
     66            'visual' => false,
     67        ) );
     68        unset( $text_widget_instance['content'] );
     69
    6270        update_option( 'use_balanceTags', 0 );
    6371        add_filter( 'widget_custom_html_content', array( $this, 'filter_widget_custom_html_content' ), 5, 3 );
     
    7684        $this->assertNotContains( '<br>', $output );
    7785        $this->assertNotContains( '</u>', $output );
    78         $this->assertEquals( $instance, $this->widget_text_args[1] );
     86        $this->assertEquals( $text_widget_instance, $this->widget_text_args[1] );
    7987        $this->assertEquals( $instance, $this->widget_custom_html_content_args[1] );
    8088        $this->assertSame( $widget, $this->widget_text_args[2] );
    8189        $this->assertSame( $widget, $this->widget_custom_html_content_args[2] );
    82         remove_filter( 'widget_custom_html_content', array( $this, 'filter_widget_custom_html_content' ), 5, 3 );
     90        remove_filter( 'widget_custom_html_content', array( $this, 'filter_widget_custom_html_content' ), 5 );
    8391        remove_filter( 'widget_text', array( $this, 'filter_widget_text' ), 10 );
    8492
Note: See TracChangeset for help on using the changeset viewer.