Making WordPress.org


Ignore:
Timestamp:
03/14/2024 05:40:44 AM (7 months ago)
Author:
tellyworth
Message:

Plugin directory: prompt plugin developers to create a blueprint for previews

This adds a notice, visible only to a plugin's developers, prompting them to test and create a blueprint.json file so users can run a Live Preview of their plugin in the WordPress Playground. The notice can be dismissed.

See #7487.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/inc/template-tags.php

    r13238 r13335  
    728728        );
    729729    }
    730 }
     730
     731    // This is less important, so only show if there are no other notices.
     732    if ( !$notice && !$import_warnings && get_post_meta( $post->ID, '_missing_blueprint_notice', true ) ) {
     733        $blueprint_test_button = sprintf(
     734            '<a class="plugin-preview" target="_blank" href="%s">%s</a>',
     735            Template::preview_link_developer( $post->post_name, Template::download_link() ),
     736            esc_html__( 'Test your plugin in Playground', 'wporg-plugins' )
     737        );
     738        $blueprint_download_button = sprintf(
     739            '<a class="plugin-preview" target="_blank" href="%s">%s</a>',
     740            Template::preview_link_developer( $post->post_name, Template::download_link(), true ),
     741            esc_html__( 'Download blueprint.json', 'wporg-plugins' )
     742        );
     743        $blueprint_dismiss_button = sprintf(
     744            '<form method="POST" action="%s"><p><input type="submit" name="dismiss" value="%s" class="plugin-preview button button-secondary alignright" /></p></form>',
     745            #'<a class="plugin-preview button button-secondary alignright" href="%s">%s</a>',
     746            Template::get_self_dismiss_blueprint_notice_link( $post ),
     747            esc_html__( 'Dismiss', 'wporg-plugins' )
     748        );
     749
     750        // There is surely a neater way to format this.
     751        $blueprint_notice = sprintf(
     752            '<ol><li>%s</li><li>%s</li><li>%s</li><li>%s</li></ol>',
     753            $blueprint_test_button,
     754            esc_html__( 'Fix any bugs in your plugin that prevent it from working in Playground.', 'wporg-plugins' ),
     755            $blueprint_download_button,
     756            esc_html__( 'Commit your blueprint to svn.', 'wporg-plugins' )
     757        );
     758        $blueprint_more = sprintf(
     759            __( 'More info can be found in the <a href="%s">plugin handbook</a>.', 'wporg-plugins' ),
     760            'https://developer.wordpress.org/plugins/wordpress-org/previews-and-blueprints/'
     761        );
     762
     763        printf(
     764            '<div class="notice notice-info notice-alt">%s</div>',
     765            '<p><strong>' . __( 'Your plugin does not yet have a blueprint file for user previews. If you\'d like to enable previews, please follow these steps to create a blueprint.', 'wporg-plugins' ) . '</strong></p>' .
     766            $blueprint_notice .
     767            $blueprint_dismiss_button .
     768            '<p>' . $blueprint_more . '</p>'
     769        );
     770    }
     771}
Note: See TracChangeset for help on using the changeset viewer.