Make WordPress Core

Ticket #46098: 46098.diff

File 46098.diff, 2.5 KB (added by garrett-eclipse, 7 years ago)

Updated patch to preserve the classic editor notice and apply the block editor notice without the dismissable.

  • src/wp-admin/includes/misc.php

     
    16191619         * @param WP_Post|null $post The currently edited post. Default null.
    16201620         */
    16211621        public static function notice( $post = null ) {
    1622                 $post = get_post( $post );
     1622                if ( is_null( $post ) ) {
     1623                        global $post;
     1624                } else {
     1625                        $post = get_post( $post );
     1626                }
    16231627
    16241628                if ( ! ( $post instanceof WP_Post ) ) {
    16251629                        return;
     
    16351639                        return;
    16361640                }
    16371641
    1638                 ?>
    1639                 <div class="notice notice-warning inline wp-pp-notice">
    1640                         <p>
    1641                         <?php
    1642                         /* translators: 1: Privacy Policy guide URL, 2: additional link attributes, 3: accessibility text */
    1643                         printf(
    1644                                 __( 'Need help putting together your new Privacy Policy page? <a href="%1$s" %2$s>Check out our guide%3$s</a> for recommendations on what content to include, along with policies suggested by your plugins and theme.' ),
    1645                                 esc_url( admin_url( 'tools.php?wp-privacy-policy-guide=1' ) ),
    1646                                 'target="_blank"',
     1642                $message = __( 'Need help putting together your new Privacy Policy page? Check out our guide for recommendations on what content to include, along with policies suggested by your plugins and theme.' );
     1643                $url     = esc_url( admin_url( 'tools.php?wp-privacy-policy-guide=1' ) );
     1644                $label   = __( 'View Privacy Policy Guide.' );
     1645
     1646                if ( get_current_screen()->is_block_editor() ) {
     1647                        wp_enqueue_script( 'wp-notices' );
     1648                        $action = array(
     1649                                'url'   => $url,
     1650                                'label' => $label,
     1651                        );
     1652                        wp_add_inline_script(
     1653                                'wp-notices',
    16471654                                sprintf(
    1648                                         '<span class="screen-reader-text"> %s</span>',
    1649                                         /* translators: accessibility text */
    1650                                         __( '(opens in a new tab)' )
    1651                                 )
     1655                                        'wp.data.dispatch( "core/notices" ).createWarningNotice( "%s", { actions: [ %s ], isDismissible: false } )',
     1656                                        $message,
     1657                                        wp_json_encode( $action )
     1658                                ),
     1659                                'after'
    16521660                        );
    1653                         ?>
    1654                         </p>
    1655                 </div>
    1656                 <?php
    1657 
     1661                } else { ?>
     1662                        <div class="notice notice-warning inline wp-pp-notice">
     1663                                <p>
     1664                                <?php
     1665                                echo $message;
     1666                                printf(
     1667                                        /* translators: 1: Privacy Policy guide URL, 2: additional link attributes, 3: link text 4: accessibility text */
     1668                                        __( ' <a href="%1$s" %2$s>%3$s%4$s</a>' ),
     1669                                        $url,
     1670                                        'target="_blank"',
     1671                                        $label,
     1672                                        sprintf(
     1673                                                '<span class="screen-reader-text"> %s</span>',
     1674                                                /* translators: accessibility text */
     1675                                                __( '(opens in a new tab)' )
     1676                                        )
     1677                                );
     1678                                ?>
     1679                                </p>
     1680                        </div>
     1681                <?php }
    16581682        }
    16591683
    16601684        /**