WPCF7_ConfigValidator::add_error()
Adds a validation error.
Метод класса: WPCF7_ConfigValidator{}
Хуки из метода
Возвращает
null
. Ничего (null).
Использование
$WPCF7_ConfigValidator = new WPCF7_ConfigValidator(); $WPCF7_ConfigValidator->add_error( $section, $code, $args );
- $section(строка) (обязательный)
- The section where the error detected.
- $code(строка) (обязательный)
- The unique code of the error.
- $args(строка|массив)
- Optional options for the error.
По умолчанию: ''
Код WPCF7_ConfigValidator::add_error() WPCF7 ConfigValidator::add error CF7 5.9.3
public function add_error( $section, $code, $args = '' ) { $args = wp_parse_args( $args, array( 'message' => '', 'params' => array(), ) ); $available_error_codes = (array) apply_filters( 'wpcf7_config_validator_available_error_codes', self::error_codes, $this->contact_form ); if ( ! in_array( $code, $available_error_codes, true ) ) { return false; } if ( ! isset( $args['link'] ) ) { $args['link'] = self::get_doc_link( $code ); } if ( ! isset( $this->errors[$section] ) ) { $this->errors[$section] = array(); } $this->errors[$section][] = array( 'code' => $code, 'args' => $args, ); return true; }