Automattic\WooCommerce\Blueprint

StepProcessorResult::add_messagepublicWC 1.0

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() WC 10.0.2

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' );
}