WPCF7_ConfigValidator::add_error()publicCF7 1.0

Adds a validation error.

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

Хуков нет.

Возвращает

null. Ничего.

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

$WPCF7_ConfigValidator = new WPCF7_ConfigValidator();
$WPCF7_ConfigValidator->add_error( $section, $code, $args );
$section(строка) (обязательный)
The section where the error detected.
$code(int) (обязательный)
The unique code of the error. This must be one of the class constants.
$args(строка|массив)
Optional options for the error.
По умолчанию: ''

Код WPCF7_ConfigValidator::add_error() CF7 5.7.5.1

public function add_error( $section, $code, $args = '' ) {
	$args = wp_parse_args( $args, array(
		'message' => '',
		'params' => array(),
	) );

	if ( ! isset( $this->errors[$section] ) ) {
		$this->errors[$section] = array();
	}

	$this->errors[$section][] = array( 'code' => $code, 'args' => $args );

	return true;
}