WPSEO_Replacevar_Editor::validate_arguments()protectedYoast 1.0

Validates the replacement variable editor arguments.

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

Хуков нет.

Возвращает

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

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->validate_arguments( $arguments );
$arguments(массив) (обязательный)
The arguments to validate.

Код WPSEO_Replacevar_Editor::validate_arguments() Yoast 22.4

protected function validate_arguments( array $arguments ) {
	$required_arguments = [
		'title',
		'description',
		'page_type_recommended',
		'page_type_specific',
		'paper_style',
	];

	foreach ( $required_arguments as $field_name ) {
		if ( ! array_key_exists( $field_name, $arguments ) ) {
			throw new InvalidArgumentException(
				sprintf(
					/* translators: %1$s expands to the missing field name.  */
					__( 'Not all required fields are given. Missing field %1$s', 'wordpress-seo' ),
					$field_name
				)
			);
		}
	}
}