WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Получай пассивный доход от сайта
функция не описана

Yoast\WP\SEO\Integrations\Admin

Social_Templates_Integration::build_social_fields() protected Yoast 1.0

Build a set of social fields for the Search Appearance section.

{} Это метод класса: Social_Templates_Integration{}

Хуков нет.

Возвращает

null. Ничего.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->build_social_fields( $yform, $identifier, $page_type_recommended, $page_type_specific );
$yform(Yoast_Form) (обязательный)
The form builder.
$identifier(строка) (обязательный)
A page-wide unique identifier for data storage and unique DOM elements.
$page_type_recommended(строка) (обязательный)
Recommended type of page for a list of replaceable variables.
$page_type_specific(строка) (обязательный)
Editor specific type of page for a list of replaceable variables.

Код Social_Templates_Integration::build_social_fields() Yoast 16.8

<?php
protected function build_social_fields( Yoast_Form $yform, $identifier, $page_type_recommended, $page_type_specific ) {
	$image_url_field_id    = 'social-image-url-' . $identifier;
	$image_id_field_id     = 'social-image-id-' . $identifier;
	$is_premium            = YoastSEO()->helpers->product->is_premium();
	$is_premium_16_5_or_up = defined( '\WPSEO_PREMIUM_VERSION' ) && \version_compare( \WPSEO_PREMIUM_VERSION, '16.5-RC0', '>=' );
	$is_form_enabled       = $is_premium && $is_premium_16_5_or_up;

	$section_class = 'yoast-settings-section';

	if ( ! $is_form_enabled ) {
		$section_class .= ' yoast-settings-section-disabled';
	}

	\printf( '<div class="%s">', \esc_attr( $section_class ) );

	echo '<div class="social-settings-heading-container">';
	echo '<h3 class="social-settings-heading">' . \esc_html__( 'Social settings', 'wordpress-seo' ) . '</h3>';
	if ( $is_form_enabled ) {
		// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Is correctly escaped in the Premium_Badge_Presenter.
		echo new Premium_Badge_Presenter( 'global-templates-' . $identifier );
		// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Is correctly escaped in the Badge_Presenter.
		echo new Badge_Presenter( 'global-templates-' . $identifier, '', $this->group );
	}
	echo '</div>';

	$yform->hidden( $image_url_field_id, $image_url_field_id );
	$yform->hidden( $image_id_field_id, $image_id_field_id );
	\printf(
		'<div
			id="%1$s"
			data-react-image-portal
			data-react-image-portal-target-image="%2$s"
			data-react-image-portal-target-image-id="%3$s"
			data-react-image-portal-is-disabled="%4$s"
			data-react-image-portal-has-image-validation="%5$s"
		></div>',
		\esc_attr( 'yoast-social-' . $identifier . '-image-select' ),
		\esc_attr( $image_url_field_id ),
		\esc_attr( $image_id_field_id ),
		\esc_attr( ! $is_form_enabled ),
		true
	);

	$editor = new WPSEO_Replacevar_Editor(
		$yform,
		[
			'title'                   => 'social-title-' . $identifier,
			'description'             => 'social-description-' . $identifier,
			'page_type_recommended'   => $page_type_recommended,
			'page_type_specific'      => $page_type_specific,
			'paper_style'             => false,
			'label_title'             => \__( 'Social title', 'wordpress-seo' ),
			'label_description'       => \__( 'Social description', 'wordpress-seo' ),
			'description_placeholder' => \__( 'Modify your social description by editing it right here.', 'wordpress-seo' ),
			'is_disabled'             => ! $is_form_enabled,
		]
	);
	$editor->render();

	if ( $is_premium && ! $is_premium_16_5_or_up ) {
		echo '<div class="yoast-settings-section-upsell">';

		$unlock_alert = \sprintf(
			/* translators: %s expands to 'Yoast SEO Premium'. */
			\esc_html__( 'To unlock this feature please update %s to the latest version.', 'wordpress-seo' ),
			'Yoast SEO Premium'
		);
		// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Output escaped above.
		echo new Alert_Presenter( $unlock_alert );

		echo '</div>';
	}

	if ( ! $is_premium ) {
		$wpseo_page = filter_input( INPUT_GET, 'page' );

		echo '<div class="yoast-settings-section-upsell">';

		echo '<a class="yoast-button-upsell" href="' . \esc_url( \add_query_arg( [ 'screen' => $wpseo_page ], WPSEO_Shortlinker::get( 'https://yoa.st/4e0' ) ) ) . '" target="_blank">'
		. \esc_html__( 'Unlock with Premium', 'wordpress-seo' )
		// phpcs:ignore WordPress.Security.EscapeOutput -- Already escapes correctly.
		. WPSEO_Admin_Utils::get_new_tab_message()
		. '<span aria-hidden="true" class="yoast-button-upsell__caret"></span>'
		. '</a>';
		echo '</div>';
	}

	echo '</div>';
}