Skip to content

Commit

Permalink
Fix bug in network site
Browse files Browse the repository at this point in the history
  • Loading branch information
leonidasmi authored and IreneStr committed Jun 29, 2022
1 parent b4043bd commit b56a8fb
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions packages/js/src/components/SchemaSettings.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* global wpseoScriptData */
import { Component, Fragment } from "@wordpress/element";
import { __, _n, sprintf } from "@wordpress/i18n";
import { makeOutboundLink } from "@yoast/helpers";
Expand All @@ -8,11 +7,6 @@ import linkHiddenFields, { linkFieldsShape } from "./higherorder/linkHiddenField

const NewsLandingPageLink = makeOutboundLink();

const {
showNewsSEOUpsell,
newsSEOUpsellURL,
} = wpseoScriptData.searchAppearance;

/**
* Returns the content of the schema settings.
*
Expand Down Expand Up @@ -43,6 +37,15 @@ class SchemaSettings extends Component {
/* eslint-enable camelcase */

this.handleOptionFocus = this.handleOptionFocus.bind( this );

this.showNewsSEOUpsell = window.wpseoScriptData?.searchAppearance?.showNewsSEOUpsell;
this.newsSEOUpsellURL = window.wpseoScriptData?.searchAppearance?.newsSEOUpsellURL;
if ( typeof this.showNewsSEOUpsell === "undefined" ) {
this.showNewsSEOUpsell = false;
}
if ( typeof this.newsSEOUpsellURL === "undefined" ) {
this.newsSEOUpsellURL = "";
}
}

/**
Expand Down Expand Up @@ -138,7 +141,7 @@ class SchemaSettings extends Component {
onOptionFocus={ this.handleOptionFocus }
selected={ this.props.articleType.value }
/> }
{ showNewsSEOUpsell && this.isNewsArticleSelected() && <Alert type="info">
{ this.showNewsSEOUpsell && this.isNewsArticleSelected() && <Alert type="info">
{
sprintf(
/* translators: %s Expands to "Yoast SEO News" */
Expand All @@ -150,7 +153,7 @@ class SchemaSettings extends Component {
) + " "
}
<NewsLandingPageLink
href={ newsSEOUpsellURL }
href={ this.newsSEOUpsellURL }
>
{
sprintf(
Expand Down

0 comments on commit b56a8fb

Please sign in to comment.