Validate::validate_not_zero( object $field )
Description #
Validate if value is not zero.
Parameters #
- $fieldobject (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' ) ) ); } }
Expand full source code Collapse full source code View on GitHub: lib/class-validate.php:362
Add your comment