Skip to content

Commit

Permalink
Add link to Plugin Suppression panel
Browse files Browse the repository at this point in the history
  • Loading branch information
delawski committed Nov 23, 2021
1 parent 68f68c2 commit 17bedd5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
23 changes: 18 additions & 5 deletions assets/src/admin/site-scan-notice/notice.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@
* WordPress dependencies
*/
import { useContext, useEffect, useMemo } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import { __, sprintf } from '@wordpress/i18n';

/**
* External dependencies
*/
import { AMP_COMPATIBLE_PLUGINS_URL } from 'amp-site-scan-notice'; // From WP inline script.
import {
AMP_COMPATIBLE_PLUGINS_URL,
SETTINGS_LINK,
} from 'amp-site-scan-notice'; // From WP inline script.

/**
* Internal dependencies
Expand All @@ -24,6 +27,10 @@ import {
import { Loading } from '../../components/loading';
import { isExternalUrl } from '../../common/helpers/is-external-url';

// Define Plugin Suppression link.
const PLUGIN_SUPPRESSION_LINK = new URL( SETTINGS_LINK );
PLUGIN_SUPPRESSION_LINK.hash = 'plugin-suppression';

export function SiteScanNotice() {
const {
cancelSiteScan,
Expand Down Expand Up @@ -79,9 +86,15 @@ export function SiteScanNotice() {
if ( isCompleted && pluginsWithAmpIncompatibility.length > 0 ) {
return (
<AdminNotice type={ ADMIN_NOTICE_TYPE_WARNING } { ...commonNoticeProps }>
<p>
{ __( 'AMP Plugin found validation errors.', 'amp' ) }
</p>
<p
dangerouslySetInnerHTML={ {
__html: sprintf(
/* translators: the placeholder is a link to the Plugin Suppression Settings panel. */
__( 'AMP Plugin found validation errors. <a href="%s">Review Plugin Suppression Settings</a>', 'amp' ),
PLUGIN_SUPPRESSION_LINK,
),
} }
/>
{ userIsTechnical && (
<details>
<a
Expand Down
1 change: 1 addition & 0 deletions includes/validation/class-amp-validation-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -2623,6 +2623,7 @@ public static function enqueue_site_scan_notice_assets( $hook ) {
'AMP_COMPATIBLE_PLUGINS_URL' => current_user_can( 'install_plugins' ) ? admin_url( '/plugin-install.php?tab=amp-compatible' ) : 'https://amp-wp.org/ecosystem/plugins/',
'APP_ROOT_ID' => 'site-scan-notice',
'OPTIONS_REST_PATH' => '/amp/v1/options',
'SETTINGS_LINK' => menu_page_url( AMP_Options_Manager::OPTION_NAME, false ),
'SCANNABLE_URLS_REST_PATH' => '/amp/v1/scannable-urls',
'USER_FIELD_DEVELOPER_TOOLS_ENABLED' => UserAccess::USER_FIELD_DEVELOPER_TOOLS_ENABLED,
'USERS_RESOURCE_REST_PATH' => '/wp/v2/users',
Expand Down

0 comments on commit 17bedd5

Please sign in to comment.