Make WordPress Core


Ignore:
Timestamp:
03/22/2018 12:58:32 AM (7 years ago)
Author:
pento
Message:

Dashboard: Introduce a "Try Gutenberg" callout.

To encourage more people to try Gutenberg, this new Dashboard box allows site users to easily install and try out Gutenberg.

Props pento, melchoyce, joen, karmatosed, joemcgill, SergeyBiryukov, jorbin.

Fixes #41316.

File:
1 edited

Legend:

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

    r42170 r42869  
    16201620    <?php
    16211621}
     1622
     1623/**
     1624 * Displays a Try Gutenberg Panel, to introduce people to Gutenberg
     1625 *
     1626 * @since 4.9.5
     1627 */
     1628function wp_try_gutenberg_panel() {
     1629    $plugins = get_plugins();
     1630    $action = $url = $classes = '';
     1631
     1632    if ( current_user_can( 'install_plugins' ) && empty( $plugins['gutenberg/gutenberg.php'] ) ) {
     1633        $action = __( 'Install Today' );
     1634        $url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=gutenberg' ), 'install-plugin_gutenberg' );
     1635        $classes = ' install-now';
     1636    } else if ( current_user_can( 'install_plugins' ) && is_plugin_inactive( 'gutenberg/gutenberg.php' ) ) {
     1637        $action = __( 'Activate Today' );
     1638        $url = wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=gutenberg/gutenberg.php&from=try-gutenberg' ), 'activate-plugin_gutenberg/gutenberg.php' );
     1639        $classes = ' activate-now';
     1640    } else if ( current_user_can( 'edit_posts' ) && is_plugin_active( 'gutenberg/gutenberg.php' ) ) {
     1641        $action = __( 'Try Today' );
     1642        $url = admin_url( 'admin.php?page=gutenberg' );
     1643    }
     1644
     1645    ?>
     1646    <div class="try-gutenberg-panel-content plugin-card-gutenberg">
     1647        <div class="try-gutenberg-panel-column-container">
     1648            <div class="try-gutenberg-panel-column try-gutenberg-panel-image-column">
     1649                <img src="https://s.w.org/images/core/gutenberg-screenshot.gif?<?php echo date( 'Ymd' ); ?>" alt="<?php esc_attr_e( 'Gutenberg animated preview' ); ?>" />
     1650            </div>
     1651            <h2><?php _e( 'Try the new editing experience' ); ?></h2>
     1652            <div class="try-gutenberg-panel-column">
     1653                <p class="about-description"><?php _e( 'WordPress is working on a better way to control your content. How about giving it a try early?' ); ?></p>
     1654                <?php if ( $action ) { ?>
     1655                    <p><a class="button button-primary button-hero<?php echo $classes; ?>" href="<?php echo esc_url( $url ); ?>"><?php echo $action; ?></a></p>
     1656                <?php } ?>
     1657            </div>
     1658            <div class="try-gutenberg-panel-column try-gutenberg-panel-last">
     1659                <h3><?php _e( 'Want to get involved?' ); ?></h3>
     1660                <ul>
     1661                    <li><?php
     1662                        printf( __( 'Learn more about the project <a href="%s">codenamed Gutenberg</a>.' ),
     1663                            'https://wordpress.org/gutenberg/'
     1664                        );
     1665                    ?></li>
     1666                    <li><?php
     1667                        printf( __( 'Help <a href="%1$s">with testing</a>, or contribute on the <a href="%2$s">GitHub repository</a>.' ),
     1668                            __( 'https://make.wordpress.org/test/handbook/call-for-testing/gutenberg-testing/' ),
     1669                            'https://github.com/WordPress/gutenberg/'
     1670                        );
     1671                    ?></li>
     1672                </ul>
     1673            </div>
     1674        </div>
     1675    </div>
     1676    <?php
     1677}
Note: See TracChangeset for help on using the changeset viewer.