Make WordPress Core


Ignore:
Timestamp:
07/24/2017 10:45:55 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.

Props westonruter, obenland, timmydcrawford for testing.
Amends [41050].
See #35243, #40951, #40907.
Fixes #41394.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/widgets/class-wp-widget-custom-html.php

    r41116 r41132  
    6262        $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
    6363
     64        // Prepare instance data that looks like a normal Text widget.
     65        $simulated_text_widget_instance = array_merge( $instance, array(
     66            'text' => isset( $instance['content'] ) ? $instance['content'] : '',
     67            'filter' => false, // Because wpautop is not applied.
     68            'visual' => false, // Because it wasn't created in TinyMCE.
     69        ) );
     70        unset( $simulated_text_widget_instance['content'] ); // Was moved to 'text' prop.
     71
    6472        /** This filter is documented in wp-includes/widgets/class-wp-widget-text.php */
    65         $content = apply_filters( 'widget_text', $instance['content'], $instance, $this );
     73        $content = apply_filters( 'widget_text', $instance['content'], $simulated_text_widget_instance, $this );
    6674
    6775        /**
Note: See TracChangeset for help on using the changeset viewer.