WPSEO_Premium_Upsell_Admin_Block::get_header │ private │ Yoast 1.0

Returns the header text and icon based on whether WooCommerce is active.

Метод класса: WPSEO_Premium_Upsell_Admin_Block{}

Хуков нет.

Возвращает

array<string, string>. The header text and icon.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->get_header( $is_woocommerce_active );
$is_woocommerce_active(true|false) (обязательный)
Whether WooCommerce is active.

Код WPSEO_Premium_Upsell_Admin_Block::get_header() Yoast 28.8

private function get_header( bool $is_woocommerce_active ) {
	$assets_uri = trailingslashit( plugin_dir_url( WPSEO_FILE ) );
	if ( $is_woocommerce_active ) {
		$header_text = sprintf(
		/* translators: %s expands to Yoast WooCommerce SEO */
			esc_html__( 'Upgrade to %s', 'wordpress-seo' ),
			'Yoast WooCommerce SEO',
		);
		$header_icon = sprintf(
			'<img src="%s" alt="" width="14" height="14" style="margin-inline-start: 8px;">',
			esc_url( $assets_uri . 'packages/js/images/icon-trolley.svg' ),
		);
	}
	else {
		$header_text = sprintf(
		/* translators: %s expands to Yoast SEO Premium*/
			esc_html__( 'Upgrade to %s', 'wordpress-seo' ),
			'Yoast SEO Premium',
		);

		$header_icon = sprintf(
			'<img src="%s" alt="" width="14" height="14" style="margin-inline-start: 8px;">',
			esc_url( $assets_uri . 'packages/js/images/icon-crown.svg' ),
		);
	}
	return [ $header_text, $header_icon ];
}