Make WordPress Core

Changeset 41135


Ignore:
Timestamp:
07/24/2017 11:14:50 PM (9 years ago)
Author:
westonruter
Message:

Widgets: Improve notice in Text widget's legacy mode.

Retains 'new' in notice on 4.8 branch, in contrast with [41134]. Also fixes phpunit test which broke in [41132].

Merges [41134] onto 4.8 branch.
Props melchoyce, westonruter.
See #41394, #35243, #40951, #40907.
Fixes #41386 for 4.8.1.

Location:
branches/4.8
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/4.8

  • branches/4.8/src/wp-includes/widgets/class-wp-widget-text.php

    r41133 r41135  
    361361                        </p>
    362362                        <div class="notice inline notice-info notice-alt">
    363                                 <p><?php _e( 'This widget may contain code that may work better in the new &#8220;Custom HTML&#8221; widget. How about trying that widget instead?' ); ?></p>
     363                                <?php if ( ! isset( $instance['visual'] ) ) : ?>
     364                                        <p><?php _e( 'This widget may contain code that may work better in the new &#8220;Custom HTML&#8221; widget. How about trying that widget instead?' ); ?></p>
     365                                <?php else : ?>
     366                                        <p><?php _e( 'This widget may have contained code that may work better in the new &#8220;Custom HTML&#8221; widget. If you haven&#8217;t yet, how about trying that widget instead?' ); ?></p>
     367                                <?php endif; ?>
    364368                        </div>
    365369                        <p>
  • branches/4.8/tests/phpunit/tests/widgets/text-widget.php

    r41133 r41135  
    458458                $form = ob_get_clean();
    459459                $this->assertContains( 'class="visual" type="hidden" value=""', $form );
    460                 $this->assertNotContains( 'class="visual" type="hidden" value="1"', $form );
     460                $this->assertNotContains( 'class="visual" type="hidden" value="on"', $form );
    461461
    462462                $instance = array(
    … …  
    469469                $widget->form( $instance );
    470470                $form = ob_get_clean();
    471                 $this->assertContains( 'class="visual" type="hidden" value="1"', $form );
     471                $this->assertContains( 'class="visual" type="hidden" value="on"', $form );
    472472                $this->assertNotContains( 'class="visual" type="hidden" value=""', $form );
    473473
    … …  
    481481                $widget->form( $instance );
    482482                $form = ob_get_clean();
    483                 $this->assertContains( 'class="visual" type="hidden" value="1"', $form );
     483                $this->assertContains( 'class="visual" type="hidden" value="on"', $form );
    484484                $this->assertNotContains( 'class="visual" type="hidden" value=""', $form );
    485485
    … …  
    494494                $widget->form( $instance );
    495495                $form = ob_get_clean();
    496                 $this->assertContains( 'class="visual" type="hidden" value="1"', $form );
     496                $this->assertContains( 'class="visual" type="hidden" value="on"', $form );
    497497                $this->assertNotContains( 'class="visual" type="hidden" value=""', $form );
    498498        }
Note: See TracChangeset for help on using the changeset viewer.