diff --git a/.github/workflows/php-test-standalone-plugins.yml b/.github/workflows/php-test-standalone-plugins.yml index 0b01cd9ec9..1f6757d430 100644 --- a/.github/workflows/php-test-standalone-plugins.yml +++ b/.github/workflows/php-test-standalone-plugins.yml @@ -76,8 +76,6 @@ jobs: node --version composer --version php -v - - name: Building standalone plugins - run: npm run build-plugins - name: Running single site standalone plugin integration tests run: npm run test-plugins - name: Running multisite standalone plugin integration tests diff --git a/README.md b/README.md index c8d8407273..34fe58479b 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Performance Lab ![Performance Lab plugin banner with icon](https://user-images.githubusercontent.com/3531426/159084476-af352db4-192e-4927-a383-7f76bb3641df.png) -Monorepo for the [WordPress Performance Team](https://make.wordpress.org/performance/), primarily for the Performance Lab plugin, which is a collection of standalone performance modules. +Monorepo for the [WordPress Performance Team](https://make.wordpress.org/performance/), primarily for the Performance Lab plugin, which is a collection of standalone performance features. Details about the Performance Lab plugin, including instructions for getting started and contributing, are available in the [Performance Team Handbook here](https://make.wordpress.org/performance/handbook/performance-lab/). diff --git a/admin/js/perflab-module-migration-notice.js b/admin/js/perflab-module-migration-notice.js deleted file mode 100644 index bdebc98f26..0000000000 --- a/admin/js/perflab-module-migration-notice.js +++ /dev/null @@ -1,56 +0,0 @@ -/* eslint camelcase: "off", no-alert: "off" */ -/* global perflab_module_migration_notice:false */ - -( function ( document ) { - document.addEventListener( 'DOMContentLoaded', function () { - document.addEventListener( 'click', function ( event ) { - if ( - event.target.classList.contains( - 'perflab-install-active-plugin' - ) - ) { - const target = event.target; - target.parentElement - .querySelector( 'span' ) - .classList.remove( 'hidden' ); - - const data = new FormData(); - data.append( - 'action', - 'perflab_install_activate_standalone_plugins' - ); - data.append( 'nonce', perflab_module_migration_notice.nonce ); - - fetch( perflab_module_migration_notice.ajaxurl, { - method: 'POST', - credentials: 'same-origin', - body: data, - } ) - .then( function ( response ) { - if ( ! response.ok ) { - throw new Error( - wp.i18n.__( - 'Network response was not ok.', - 'performance-lab' - ) - ); - } - return response.json(); - } ) - .then( function ( result ) { - target.parentElement - .querySelector( 'span' ) - .classList.add( 'hidden' ); - if ( ! result.success ) { - alert( result.data.errorMessage ); - } - window.location.reload(); - } ) - .catch( function ( error ) { - alert( error.errorMessage ); - window.location.reload(); - } ); - } - } ); - } ); -} )( document ); diff --git a/admin/load.php b/admin/load.php index d29937498c..3b89a6db8d 100644 --- a/admin/load.php +++ b/admin/load.php @@ -1,6 +1,6 @@ __( 'Other', 'performance-lab' ) ); - foreach ( $sections as $section_slug => $section_data ) { - add_settings_section( - $section_slug, - $section_data['name'], - null, - PERFLAB_MODULES_SCREEN - ); - } - - // Register fields for all modules. - if ( ! is_array( $modules ) ) { - $modules = perflab_get_modules(); - } - $settings = perflab_get_module_settings(); - foreach ( $modules as $module_slug => $module_data ) { - $module_settings = isset( $settings[ $module_slug ] ) ? $settings[ $module_slug ] : array(); - $module_section = isset( $sections[ $module_data['focus'] ] ) ? $module_data['focus'] : 'other'; - - // Mark this module's section as added. - $sections[ $module_section ]['added'] = true; - - add_settings_field( - $module_slug, - $module_data['name'], - static function () use ( $module_slug, $module_data, $module_settings ) { - perflab_render_modules_page_field( $module_slug, $module_data, $module_settings ); - }, - PERFLAB_MODULES_SCREEN, - $module_section - ); - } - - // Remove all sections for which there are no modules. - foreach ( $sections as $section_slug => $section_data ) { - if ( empty( $section_data['added'] ) ) { - unset( $wp_settings_sections[ PERFLAB_MODULES_SCREEN ][ $section_slug ] ); - } - } } /** - * Renders the modules page. + * Renders the plugin page. * * @since 1.0.0 + * @since n.e.x.t Renamed to perflab_render_settings_page(). */ -function perflab_render_modules_page() { +function perflab_render_settings_page() { ?>
'; - $message .= esc_html__( 'Your site is using modules which will be removed in the future in favor of their equivalent standalone plugins.', 'performance-lab' ); - $message .= ' '; - $message .= esc_html( $additional_message ); - $message .= ' '; - $message .= esc_html__( 'This will not impact any of the underlying functionality.', 'performance-lab' ); - $message .= '
'; - $message .= '' . esc_html__( 'Available standalone plugins:', 'performance-lab' ) . ''; - $message .= '