Automattic\WooCommerce\Internal\Admin\EmailPreview
EmailPreviewRestController::validate_email_type()
Validate the email type.
Метод класса: EmailPreviewRestController{}
Хуков нет.
Возвращает
true|false|WP_Error
. True if the email type is valid, otherwise a WP_Error object.
Использование
// private - только в коде основоного (родительского) класса $result = $this->validate_email_type( $email_type );
- $email_type(строка) (обязательный)
- The email type to validate.
Код EmailPreviewRestController::validate_email_type() EmailPreviewRestController::validate email type WC 9.6.1
private function validate_email_type( string $email_type ) { try { $this->email_preview->set_email_type( $email_type ); } catch ( \InvalidArgumentException $e ) { return new WP_Error( 'woocommerce_rest_invalid_email_type', __( 'Invalid email type.', 'woocommerce' ), array( 'status' => 400 ), ); } return true; }