WPSEO_Replacevar_Editor::__construct()publicYoast 1.0

Constructs the object.

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

Хуков нет.

Возвращает

null. Ничего (null).

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

$WPSEO_Replacevar_Editor = new WPSEO_Replacevar_Editor();
$WPSEO_Replacevar_Editor->__construct( $yform, $arguments );
$yform(Yoast_Form) (обязательный)
Yoast forms.
$arguments(массив) (обязательный)

The arguments that can be given.

  • title(строка)
    The title field id.

  • description(строка)
    The description field id.

  • page_type_recommended(строка)
    The page type for the context of the recommended replace vars.

  • page_type_specific(строка)
    The page type for the context of the editor specific replace vars.

  • paper_style(true|false)
    Optional. Whether the editor has paper style.

  • label_title(строка)
    Optional. The label to use for the title field.

  • label_description(строка)
    Optional. The label to use for the description field.

  • description_placeholder(строка)
    Optional. The placeholder text to use for the description field.

  • has_new_badge(true|false)
    Optional. Whether to show the "New" badge.

  • has_premium_badge(true|false)
    Optional. Whether to show the "Premium" badge.

Код WPSEO_Replacevar_Editor::__construct() Yoast 22.4

public function __construct( Yoast_Form $yform, $arguments ) {
	$arguments = wp_parse_args(
		$arguments,
		[
			'paper_style'             => true,
			'label_title'             => '',
			'label_description'       => '',
			'description_placeholder' => '',
			'has_new_badge'           => false,
			'is_disabled'             => false,
			'has_premium_badge'       => false,
		]
	);

	$this->validate_arguments( $arguments );

	$this->yform     = $yform;
	$this->arguments = [
		'title'                   => (string) $arguments['title'],
		'description'             => (string) $arguments['description'],
		'page_type_recommended'   => (string) $arguments['page_type_recommended'],
		'page_type_specific'      => (string) $arguments['page_type_specific'],
		'paper_style'             => (bool) $arguments['paper_style'],
		'label_title'             => (string) $arguments['label_title'],
		'label_description'       => (string) $arguments['label_description'],
		'description_placeholder' => (string) $arguments['description_placeholder'],
		'has_new_badge'           => (bool) $arguments['has_new_badge'],
		'is_disabled'             => (bool) $arguments['is_disabled'],
		'has_premium_badge'       => (bool) $arguments['has_premium_badge'],
	];
}