| @@ 224-256 (lines=33) @@ | ||
| 221 | * |
|
| 222 | * @since 2.0 |
|
| 223 | */ |
|
| 224 | public function input ( $name, $value = null, $options = null, $pod = null, $id = null ) { |
|
| 225 | $options = (array) $options; |
|
| 226 | $form_field_type = PodsForm::$field_type; |
|
| 227 | ||
| 228 | if ( is_array( $value ) ) |
|
| 229 | $value = implode( '', $value ); |
|
| 230 | ||
| 231 | if ( 'slider' == pods_var( self::$type . '_format_type', $options, 'number' ) ) |
|
| 232 | $field_type = 'slider'; |
|
| 233 | else |
|
| 234 | $field_type = 'number'; |
|
| 235 | ||
| 236 | if ( isset( $options[ 'name' ] ) && false === PodsForm::permission( self::$type, $options[ 'name' ], $options, null, $pod, $id ) ) { |
|
| 237 | if ( pods_var( 'read_only', $options, false ) ) { |
|
| 238 | $options[ 'readonly' ] = true; |
|
| 239 | ||
| 240 | $field_type = 'text'; |
|
| 241 | ||
| 242 | $value = $this->format( $value, $name, $options, $pod, $id ); |
|
| 243 | } |
|
| 244 | else |
|
| 245 | return; |
|
| 246 | } |
|
| 247 | elseif ( !pods_has_permissions( $options ) && pods_var( 'read_only', $options, false ) ) { |
|
| 248 | $options[ 'readonly' ] = true; |
|
| 249 | ||
| 250 | $field_type = 'text'; |
|
| 251 | ||
| 252 | $value = $this->format( $value, $name, $options, $pod, $id ); |
|
| 253 | } |
|
| 254 | ||
| 255 | pods_view( PODS_DIR . 'ui/fields/' . $field_type . '.php', compact( array_keys( get_defined_vars() ) ) ); |
|
| 256 | } |
|
| 257 | ||
| 258 | /** |
|
| 259 | * Build regex necessary for JS validation |
|
| @@ 322-360 (lines=39) @@ | ||
| 319 | * |
|
| 320 | * @since 2.0 |
|
| 321 | */ |
|
| 322 | public function input( $name, $value = null, $options = null, $pod = null, $id = null ) { |
|
| 323 | ||
| 324 | $options = (array) $options; |
|
| 325 | $form_field_type = PodsForm::$field_type; |
|
| 326 | ||
| 327 | if ( is_array( $value ) ) { |
|
| 328 | $value = implode( '', $value ); |
|
| 329 | } |
|
| 330 | ||
| 331 | if ( 'slider' == pods_v( self::$type . '_format_type', $options, 'number' ) ) { |
|
| 332 | $field_type = 'slider'; |
|
| 333 | } |
|
| 334 | else { |
|
| 335 | $field_type = 'currency'; |
|
| 336 | } |
|
| 337 | ||
| 338 | if ( isset( $options[ 'name' ] ) && false === PodsForm::permission( self::$type, $options[ 'name' ], $options, null, $pod, $id ) ) { |
|
| 339 | if ( pods_v( 'read_only', $options, false ) ) { |
|
| 340 | $options[ 'readonly' ] = true; |
|
| 341 | ||
| 342 | $field_type = 'text'; |
|
| 343 | ||
| 344 | $value = $this->format( $value, $name, $options, $pod, $id ); |
|
| 345 | } |
|
| 346 | else { |
|
| 347 | return; |
|
| 348 | } |
|
| 349 | } |
|
| 350 | elseif ( !pods_has_permissions( $options ) && pods_v( 'read_only', $options, false ) ) { |
|
| 351 | $options[ 'readonly' ] = true; |
|
| 352 | ||
| 353 | $field_type = 'text'; |
|
| 354 | ||
| 355 | $value = $this->format( $value, $name, $options, $pod, $id ); |
|
| 356 | } |
|
| 357 | ||
| 358 | pods_view( PODS_DIR . 'ui/fields/' . $field_type . '.php', compact( array_keys( get_defined_vars() ) ) ); |
|
| 359 | ||
| 360 | } |
|
| 361 | ||
| 362 | /** |
|
| 363 | * Build regex necessary for JS validation |
|