Validate::validate_not_zero( object $field )

Description #

Validate if value is not zero.

Parameters #

  • $field
    object (Required) Instance of @see AP_Field object.

Source #

File: lib/class-validate.php

	public static function validate_not_zero( $field ) {
		if ( '0' == $field->value() ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
			$field->add_error(
				'is-zero',
				sprintf(
					// Translators: placeholder contain field label.
					__( '%s field is required.', 'anspress-question-answer' ),
					$field->get( 'label' )
				)
			);
		}
	}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment