Making WordPress.org


Ignore:
Timestamp:
12/04/2023 04:42:52 AM (2 years ago)
Author:
tellyworth
Message:

Plugins: improved Test Preview button

This uses the new Playground blueprint-url param to pass the blueprint rather than a URL fragment.

Also, opens the preview in a new tab, as per suggestions.

See #7251.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-plugin-blueprint.php

    r12998 r12999  
    3737        $blueprints = get_post_meta( $plugin->ID, 'assets_blueprints', true );
    3838        // Note: for now, only use a file called `blueprint.json`.
    39         if ( !isset( $blueprints['blueprint.json'] ) ) {
    40             return false;
     39        if ( !isset( $blueprints['blueprint.json'] ) ) {
     40            return new \WP_Error( 'no_blueprint', 'File not found', array( 'status' => 404 ) );
    4141        }
    4242        $blueprint = $blueprints['blueprint.json'];
    4343        if ( !$blueprint || !isset( $blueprint['contents'] ) || !is_string( $blueprint['contents'] ) ) {
    44             return false;
     44            return new \WP_Error( 'invalid_blueprint', 'Invalid file', array( 'status' => 500 ) );
    4545        }
    4646
Note: See TracChangeset for help on using the changeset viewer.