nf_field_text_edit_input_mask

The Ninja Forms nf field text edit input mask function.

Description

nf_field_text_edit_input_mask( $field_id, $data ); 

Parameters (2)

0. $field_id
The field id.
1. $data
The data.

Usage

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

Defined (1)

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

/deprecated/includes/fields/textbox.php  
  1. function nf_field_text_edit_input_mask( $field_id, $data ) { 
  2. $field = ninja_forms_get_field_by_id( $field_id ); 
  3. if ( '_text' != $field['type'] ) 
  4. return false; 
  5.  
  6. $custom = ''; 
  7. // Field Mask  
  8. $mask = isset( $data['mask'] ) ? $data['mask'] : ''; 
  9. $plugin_settings = nf_get_settings(); 
  10. $currency_symbol = $plugin_settings['currency_symbol']; 
  11. $date_format = $plugin_settings['date_format']; 
  12. ?> 
  13. <div class="description description-thin"> 
  14. <span class="field-option"> 
  15. <label for=""> 
  16. <?php _e( 'Input Mask' , 'ninja-forms'); ?> 
  17. </label><br /> 
  18. <select id="mask_<?php echo $field_id;?>" name="" class="widefat ninja-forms-_text-mask"> 
  19. <option value="" <?php if($mask == '') { echo 'selected'; $custom = 'no';}?>><?php _e('None', 'ninja-forms'); ?></option> 
  20. <option value="(999) 999-9999" <?php if($mask == '(999) 999-9999') { echo 'selected'; $custom = 'no';}?>><?php _e('Phone - (555) 555-5555', 'ninja-forms'); ?></option> 
  21. <option value="date" <?php if($mask == 'date') { echo 'selected'; $custom = 'no';}?>><?php _e('Date', 'ninja-forms'); ?> - <?php echo $date_format;?></option> 
  22. <option value="currency" <?php if($mask == 'currency') { echo 'selected'; $custom = 'no';}?>><?php _e('Currency', 'ninja-forms'); ?> - <?php echo $currency_symbol;?></option> 
  23. <option value="_custom" <?php if($custom != 'no') { echo 'selected';}?>><?php _e('Custom', 'ninja-forms'); ?> -></option> 
  24. </select> 
  25.  
  26. </span> 
  27. </div> 
  28. <div class="description description-thin"> 
  29. <span class="field-option"> 
  30. <label for="" id="mask_label_<?php echo $field_id;?>" style="<?php if($custom == 'no') { echo 'display:none;';}?>"> 
  31. <?php _e( 'Custom Mask Definition' , 'ninja-forms'); ?>         <a href="#" name="" class="ninja-forms-mask-help"><?php _e( 'Help', 'ninja-forms' ); ?></a><br /> 
  32. <input type="text" id="ninja_forms_field_<?php echo $field_id;?>_mask" name="ninja_forms_field_<?php echo $field_id;?>[mask]" class="widefat code" value="<?php echo $mask; ?>" /> 
  33. </label> 
  34. </span> 
  35. </div> 
  36. <?php