Skip to content

Commit

Permalink
refactor: isAIFeatureEnabled
Browse files Browse the repository at this point in the history
  • Loading branch information
vraja-pro committed Sep 12, 2024
1 parent 1584e5a commit 54b0812
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 0 additions & 1 deletion inc/class-wpseo-utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,6 @@ public static function get_admin_l10n() {
'isBreadcrumbsDisabled' => WPSEO_Options::get( 'breadcrumbs-enable', false ) !== true && ! current_theme_supports( 'yoast-seo-breadcrumbs' ),
// phpcs:ignore Generic.ControlStructures.DisallowYodaConditions -- Bug: squizlabs/PHP_CodeSniffer#2962.
'isPrivateBlog' => ( (string) get_option( 'blog_public' ) ) === '0',
'isAiFeatureActive' => (bool) WPSEO_Options::get( 'enable_ai_generator' ),
];

$additional_entries = apply_filters( 'wpseo_admin_l10n', [] );
Expand Down
2 changes: 1 addition & 1 deletion packages/js/src/redux/reducers/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function getDefaultState() {
isWincherIntegrationActive: isWincherIntegrationActive(),
isInsightsEnabled: get( window, "wpseoScriptData.metabox.isInsightsEnabled", false ),
isNewsEnabled: get( window, "wpseoScriptData.metabox.isNewsSeoActive", false ),
isAiFeatureActive: Boolean( window.wpseoAdminL10n.isAiFeatureActive ),
isAiFeatureActive: Boolean( window.wpseoScriptData.isAiFeatureActive ),
isWooCommerceSeoActive: get( window, "wpseoScriptData.metabox.isWooCommerceSeoActive", false ),
isWooCommerceActive: get( window, "wpseoScriptData.metabox.isWooCommerceActive", false ),
};
Expand Down
3 changes: 3 additions & 0 deletions src/editors/framework/site/base-site-information.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Yoast\WP\SEO\Editors\Framework\Site;

use Exception;
use WPSEO_Options;
use Yoast\WP\SEO\Helpers\Product_Helper;
use Yoast\WP\SEO\Helpers\Short_Link_Helper;
use Yoast\WP\SEO\Introductions\Infrastructure\Wistia_Embed_Permission_Repository;
Expand Down Expand Up @@ -80,6 +81,7 @@ public function get_site_information(): array {
'isRtl' => \is_rtl(),
'isPremium' => $this->product_helper->is_premium(),
'siteIconUrl' => \get_site_icon_url(),
'isAiFeatureActive' => WPSEO_Options::get( 'enable_ai_generator' ),
];
}

Expand All @@ -95,6 +97,7 @@ public function get_legacy_site_information(): array {
'linkParams' => $this->short_link_helper->get_query_params(),
'pluginUrl' => \plugins_url( '', \WPSEO_FILE ),
'wistiaEmbedPermission' => $this->wistia_embed_permission_repository->get_value_for_user( \get_current_user_id() ),
'isAiFeatureActive' => WPSEO_Options::get( 'enable_ai_generator' ),
'metabox' => [
'site_name' => $this->meta->for_current_page()->site_name,
'contentLocale' => \get_locale(),
Expand Down

0 comments on commit 54b0812

Please sign in to comment.