Make WordPress Core


Ignore:
Timestamp:
07/18/2018 06:41:07 AM (6 years ago)
Author:
pento
Message:

Dashboard: Introduce the "Try Gutenberg" callout.

To encourage folks to prepare for Gutenberg, this new Dashboard box allows site users to easily install and try the Gutenberg plugin now, or to install the Classic Editor plugin before WordPress 5.0 is released.

Props pento, melchoyce, joen, karmatosed, joemcgill, SergeyBiryukov, jorbin, bph, Clorith, afercia, chanthaboune, chrislema, kjellr, matveb, michelleweber.
Fixes #41316.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/4.9/src/wp-admin/index.php

    r42883 r43502  
    104104    <h1><?php echo esc_html( $title ); ?></h1>
    105105
     106<?php if ( has_action( 'try_gutenberg_panel' ) ) :
     107    $classes = 'try-gutenberg-panel';
     108
     109    $option = get_user_meta( get_current_user_id(), 'show_try_gutenberg_panel', true );
     110    // 0 = hide, 1 = toggled to show or single site creator, 2 = multisite site owner
     111    $hide = '0' === $option || ( '2' === $option && wp_get_current_user()->user_email !== get_option( 'admin_email' ) );
     112    if ( $hide )
     113        $classes .= ' hidden'; ?>
     114
     115    <div id="try-gutenberg-panel" class="<?php echo esc_attr( $classes ); ?>">
     116        <?php wp_nonce_field( 'try-gutenberg-panel-nonce', 'trygutenbergpanelnonce', false ); ?>
     117        <a class="try-gutenberg-panel-close" href="<?php echo esc_url( admin_url( '?try_gutenberg=0' ) ); ?>" aria-label="<?php esc_attr_e( 'Dismiss the Try Gutenberg panel' ); ?>"><?php _e( 'Dismiss' ); ?></a>
     118        <?php
     119        /**
     120         * Add content to the Try Gutenberg panel on the admin dashboard.
     121         *
     122         * To remove the Try Gutenberg panel, use remove_action():
     123         *
     124         *     remove_action( 'try_gutenberg_panel', 'wp_try_gutenberg_panel' );
     125         *
     126         * @since 4.9.8
     127         */
     128        do_action( 'try_gutenberg_panel' );
     129        ?>
     130    </div>
     131<?php endif; ?>
    106132<?php if ( has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) :
    107133    $classes = 'welcome-panel';
     
    109135    $option = get_user_meta( get_current_user_id(), 'show_welcome_panel', true );
    110136    // 0 = hide, 1 = toggled to show or single site creator, 2 = multisite site owner
    111     $hide = 0 == $option || ( 2 == $option && wp_get_current_user()->user_email != get_option( 'admin_email' ) );
     137    $hide = '0' === $option || ( '2' === $option && wp_get_current_user()->user_email != get_option( 'admin_email' ) );
    112138    if ( $hide )
    113139        $classes .= ' hidden'; ?>
Note: See TracChangeset for help on using the changeset viewer.