Yoast_Input_Validation::get_the_aria_describedby_attribute()public staticYoast 12.1

Gets the aria-describedby HTML attribute based on the submitted invalid value.

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

Хуков нет.

Возвращает

Строку. The aria-describedby HTML attribute or empty string.

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

$result = Yoast_Input_Validation::get_the_aria_describedby_attribute( $error_code );
$error_code(строка) (обязательный)
Code of the error set via add_settings_error(), normally the variable name.

Список изменений

С версии 12.1 Введена.

Код Yoast_Input_Validation::get_the_aria_describedby_attribute() Yoast 23.5

public static function get_the_aria_describedby_attribute( $error_code ) {
	if ( self::yoast_form_control_has_error( $error_code ) && self::get_error_description( $error_code ) ) {
		return ' aria-describedby="' . esc_attr( $error_code ) . '-error-description"';
	}

	return '';
}