Automattic\WooCommerce\Blueprint
StepProcessorResult::add_message
Add a new message.
Метод класса: StepProcessorResult{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$StepProcessorResult = new StepProcessorResult(); $StepProcessorResult->add_message( $message, $type );
- $message(строка) (обязательный)
- message.
- $type(строка)
- one of error, info.
По умолчанию:'error'
Код StepProcessorResult::add_message() StepProcessorResult::add message WC 10.9.1
public function add_message( string $message, string $type = 'error' ) {
if ( ! in_array( $type, self::MESSAGE_TYPES, true ) ) {
// phpcs:ignore
throw new InvalidArgumentException( "{$type} is not allowed. Type must be one of " . implode( ',', self::MESSAGE_TYPES ) );
}
$this->messages[] = compact( 'message', 'type' );
}