| @@ 199-220 (lines=22) @@ | ||
| 196 | /** |
|
| 197 | * {@inheritdoc} |
|
| 198 | */ |
|
| 199 | public function validate( $value, $name = null, $options = null, $fields = null, $pod = null, $id = null, $params = null ) { |
|
| 200 | ||
| 201 | $errors = array(); |
|
| 202 | ||
| 203 | $check = $this->pre_save( $value, $id, $name, $options, $fields, $pod, $params ); |
|
| 204 | ||
| 205 | if ( is_array( $check ) ) { |
|
| 206 | $errors = $check; |
|
| 207 | } else { |
|
| 208 | if ( 0 < strlen( $value ) && '' === $check ) { |
|
| 209 | if ( 1 === (int) pods_v( 'required', $options ) ) { |
|
| 210 | $errors[] = __( 'This field is required.', 'pods' ); |
|
| 211 | } |
|
| 212 | } |
|
| 213 | } |
|
| 214 | ||
| 215 | if ( ! empty( $errors ) ) { |
|
| 216 | return $errors; |
|
| 217 | } |
|
| 218 | ||
| 219 | return true; |
|
| 220 | } |
|
| 221 | ||
| 222 | /** |
|
| 223 | * {@inheritdoc} |
|
| @@ 106-127 (lines=22) @@ | ||
| 103 | /** |
|
| 104 | * {@inheritdoc} |
|
| 105 | */ |
|
| 106 | public function validate( $value, $name = null, $options = null, $fields = null, $pod = null, $id = null, $params = null ) { |
|
| 107 | ||
| 108 | $errors = array(); |
|
| 109 | ||
| 110 | $check = $this->pre_save( $value, $id, $name, $options, $fields, $pod, $params ); |
|
| 111 | ||
| 112 | if ( is_array( $check ) ) { |
|
| 113 | $errors = $check; |
|
| 114 | } else { |
|
| 115 | if ( 0 < strlen( $value ) && '' === $check ) { |
|
| 116 | if ( 1 === (int) pods_v( 'required', $options ) ) { |
|
| 117 | $errors[] = __( 'This field is required.', 'pods' ); |
|
| 118 | } |
|
| 119 | } |
|
| 120 | } |
|
| 121 | ||
| 122 | if ( ! empty( $errors ) ) { |
|
| 123 | return $errors; |
|
| 124 | } |
|
| 125 | ||
| 126 | return true; |
|
| 127 | } |
|
| 128 | ||
| 129 | /** |
|
| 130 | * {@inheritdoc} |
|
| @@ 152-173 (lines=22) @@ | ||
| 149 | /** |
|
| 150 | * {@inheritdoc} |
|
| 151 | */ |
|
| 152 | public function validate( $value, $name = null, $options = null, $fields = null, $pod = null, $id = null, $params = null ) { |
|
| 153 | ||
| 154 | $errors = array(); |
|
| 155 | ||
| 156 | $check = $this->pre_save( $value, $id, $name, $options, $fields, $pod, $params ); |
|
| 157 | ||
| 158 | if ( is_array( $check ) ) { |
|
| 159 | $errors = $check; |
|
| 160 | } else { |
|
| 161 | if ( 0 < strlen( $value ) && '' === $check ) { |
|
| 162 | if ( 1 === (int) pods_v( 'required', $options ) ) { |
|
| 163 | $errors[] = __( 'This field is required.', 'pods' ); |
|
| 164 | } |
|
| 165 | } |
|
| 166 | } |
|
| 167 | ||
| 168 | if ( ! empty( $errors ) ) { |
|
| 169 | return $errors; |
|
| 170 | } |
|
| 171 | ||
| 172 | return true; |
|
| 173 | } |
|
| 174 | ||
| 175 | /** |
|
| 176 | * {@inheritdoc} |
|