ninja_forms_field_number_display

The Ninja Forms ninja forms field number display function.

Description

ninja_forms_field_number_display( $field_id, $data, (string) $form_id = '' ); 

Parameters (3)

0. $field_id
The field id.
1. $data
The data.
2. $form_id — Optional. (string) => ''
The form id.

Usage

  1. if ( !function_exists( 'ninja_forms_field_number_display' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'ninja-forms/deprecated/includes/fields/number.php'; 
  3.  
  4. // The field id. 
  5. $field_id = null; 
  6.  
  7. // The data. 
  8. $data = null; 
  9.  
  10. // The form id. 
  11. $form_id = ''; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = ninja_forms_field_number_display($field_id, $data, $form_id); 
  15.  

Defined (1)

The function is defined in the following location(s).

/deprecated/includes/fields/number.php  
  1. function ninja_forms_field_number_display( $field_id, $data, $form_id = '' ) { 
  2. if ( isset( $data['default_value'] ) ) { 
  3. $default_value = $data['default_value']; 
  4. } elseif( isset( $data['number_min'] ) ) { 
  5. $default_value = $data['number_min']; 
  6.  
  7. if ( isset( $data['number_min'] ) ) { 
  8. $min = ' min="' . esc_attr( $data['number_min'] ) . '"'; 
  9. } else { 
  10. $min = ''; 
  11.  
  12. if ( isset( $data['number_max'] ) ) { 
  13. $max = ' max="' . esc_attr( $data['number_max'] ) . '"'; 
  14. } else { 
  15. $max = ''; 
  16.  
  17. if ( isset( $data['number_step'] ) ) { 
  18. $step = ' step="' . esc_attr( $data['number_step'] ) . '"'; 
  19. } else { 
  20. $step = ''; 
  21.  
  22. $field_class = ninja_forms_get_field_class( $field_id, $form_id ); 
  23.  
  24. ?> 
  25. <input type="number"<?php echo $min . $max . $step; ?> name="ninja_forms_field_<?php echo esc_attr( $field_id ); ?>" id="ninja_forms_field_<?php echo esc_attr( $field_id ); ?>" class="<?php echo esc_attr( $field_class ); ?>" rel="<?php echo esc_attr( $field_id ); ?>" value="<?php echo esc_attr( $default_value ); ?>"/> 
  26. <?php