diff --git a/admin/tracking/class-tracking-settings-data.php b/admin/tracking/class-tracking-settings-data.php index f8cc8ab5df3..4410b28e5b8 100644 --- a/admin/tracking/class-tracking-settings-data.php +++ b/admin/tracking/class-tracking-settings-data.php @@ -245,6 +245,7 @@ class WPSEO_Tracking_Settings_Data implements WPSEO_Collection { 'llms_txt_selection_mode', 'configuration_finished_steps', 'enable_task_list', + 'enable_schema', ]; /** diff --git a/images/icon-schema.svg b/images/icon-schema.svg new file mode 100644 index 00000000000..58be81ebfe2 --- /dev/null +++ b/images/icon-schema.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/inc/options/class-wpseo-option-wpseo.php b/inc/options/class-wpseo-option-wpseo.php index 2bc32227fbd..243d4ea5dd8 100644 --- a/inc/options/class-wpseo-option-wpseo.php +++ b/inc/options/class-wpseo-option-wpseo.php @@ -155,6 +155,7 @@ class WPSEO_Option_Wpseo extends WPSEO_Option { 'default_seo_meta_desc' => [], 'first_activated_by' => 0, 'enable_task_list' => true, + 'enable_schema' => true, ]; /** @@ -549,6 +550,7 @@ protected function validate_option( $dirty, $clean, $old ) { * 'google_site_kit_feature_enabled', * 'enable_llms_txt', * 'enable_task_list', + * 'enable_schema', * and most of the feature variables. */ default: @@ -620,6 +622,7 @@ public function verify_features_against_network( $options = [] ) { 'google_site_kit_feature_enabled' => false, 'enable_llms_txt' => false, 'enable_task_list' => false, + 'enable_schema' => false, ]; // We can reuse this logic from the base class with the above defaults to parse with the correct feature values. diff --git a/packages/js/src/integrations-page/plugin-integration.js b/packages/js/src/integrations-page/plugin-integration.js index 1b96de10b84..7b3e708e56d 100644 --- a/packages/js/src/integrations-page/plugin-integration.js +++ b/packages/js/src/integrations-page/plugin-integration.js @@ -4,27 +4,37 @@ import { __ } from "@wordpress/i18n"; import { PropTypes } from "prop-types"; import { SimpleIntegration } from "./simple-integration"; +// Flag to check if the Schema Framework is enabled. +// eslint-disable-next-line dot-notation +const isSchemaFrameworkEnabled = Boolean( window.wpseoIntegrationsData[ "schema_framework_enabled" ] ); + /** * Represents an integration. * * @param {Object} integration The integration. * @param {boolean} [isActive=true] The integration state. + * @param {boolean} [isSchemaAPIIntegration=false] Whether this is a Schema API integration. * * @returns {JSX.Element} A card representing an integration. */ -export const PluginIntegration = ( { integration, isActive = true } ) => { +export const PluginIntegration = ( { integration, isActive = true, isSchemaAPIIntegration = false } ) => { + const isSchemaFrameworkDisabled = isSchemaAPIIntegration && ! isSchemaFrameworkEnabled; + return ( - { isActive && + { isSchemaFrameworkDisabled && + { __( "Schema Framework disabled", "wordpress-seo" ) } + } + { ! isSchemaFrameworkDisabled && isActive && { __( "Integration active", "wordpress-seo" ) } } - { ! isActive && + { ! isSchemaFrameworkDisabled && ! isActive && { __( "Plugin not detected", "wordpress-seo" ) @@ -49,4 +59,5 @@ PluginIntegration.propTypes = { isNew: PropTypes.bool, } ).isRequired, isActive: PropTypes.bool, + isSchemaAPIIntegration: PropTypes.bool, }; diff --git a/packages/js/src/integrations-page/schema-api-integrations.js b/packages/js/src/integrations-page/schema-api-integrations.js index bcef359df9b..938f8f29400 100644 --- a/packages/js/src/integrations-page/schema-api-integrations.js +++ b/packages/js/src/integrations-page/schema-api-integrations.js @@ -150,6 +150,7 @@ const SchemaAPIIntegrations = [ key={ index } integration={ integration } isActive={ getInitialState( integration ) } + isSchemaAPIIntegration={ true } /> ); } ), @@ -164,6 +165,7 @@ SchemaAPIIntegrations.push( isPrerequisiteActive={ Boolean( window.wpseoIntegrationsData[ "woocommerce_active" ] ) } upsellLink={ window.wpseoIntegrationsData[ "woocommerce_seo_upsell_url" ] } activationLink={ window.wpseoIntegrationsData[ "woocommerce_seo_activate_url" ] } + isSchemaAPIIntegration={ true } /> ); /* eslint-enable dot-notation */ diff --git a/packages/js/src/integrations-page/woocommerce-integration.js b/packages/js/src/integrations-page/woocommerce-integration.js index bed3b96aa9a..d1130c35c11 100644 --- a/packages/js/src/integrations-page/woocommerce-integration.js +++ b/packages/js/src/integrations-page/woocommerce-integration.js @@ -7,12 +7,17 @@ import { Button } from "@yoast/ui-library"; import { PropTypes } from "prop-types"; import { SimpleIntegration } from "./simple-integration"; +// Flag to check if the Schema Framework is enabled. +// eslint-disable-next-line dot-notation +const isSchemaFrameworkEnabled = Boolean( window.wpseoIntegrationsData[ "schema_framework_enabled" ] ); + /** * @param {Object} integration The integration object. * @param {boolean} [isActive=true] Whether the integration is active. * @param {boolean} [isInstalled=true] Whether the integration is installed. * @param {boolean} [isPrerequisiteActive=true] Whether the prerequisite plugin is active. * @param {string} activationLink The URL to activate Yoast WooCommerce SEO. + * @param {boolean} [isSchemaAPIIntegration=false] Whether this is a Schema API integration. * @returns {JSX.Element} A card representing an integration. */ export const WoocommerceIntegration = ( { @@ -21,13 +26,19 @@ export const WoocommerceIntegration = ( { isInstalled = true, isPrerequisiteActive = true, activationLink, + isSchemaAPIIntegration = false, } ) => { + const isSchemaFrameworkDisabled = isSchemaAPIIntegration && ! isSchemaFrameworkEnabled; + return ( - { ! isPrerequisiteActive && + { isSchemaFrameworkDisabled && + { __( "Schema Framework disabled", "wordpress-seo" ) } + } + { ! isSchemaFrameworkDisabled && ! isPrerequisiteActive && { __( "Plugin not detected", "wordpress-seo" ) @@ -37,13 +48,13 @@ export const WoocommerceIntegration = ( { className="yst-h-5 yst-w-5 yst-text-red-500 yst-flex-shrink-0" /> } - { isPrerequisiteActive && isActive && + { ! isSchemaFrameworkDisabled && isPrerequisiteActive && isActive && { __( "Integration active", "wordpress-seo" ) } } - { isPrerequisiteActive && ! isActive && isInstalled && + { ! isSchemaFrameworkDisabled && isPrerequisiteActive && ! isActive && isInstalled &&