ninja_forms_register_field

The Ninja Forms ninja forms register field function.

Description

ninja_forms_register_field( $slug, (array) $args = array() ); 

Parameters (2)

0. $slug
The slug.
1. $args — Optional. (array) => array()
The args.

Usage

  1. if ( !function_exists( 'ninja_forms_register_field' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'ninja-forms/deprecated/includes/register.php'; 
  3.  
  4. // The slug. 
  5. $slug = null; 
  6.  
  7. // The args. 
  8. $args = array(); 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = ninja_forms_register_field($slug, $args); 
  12.  

Defined (1)

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

/deprecated/includes/register.php  
  1. function ninja_forms_register_field($slug, $args = array()) { 
  2. global $ninja_forms_fields; 
  3.  
  4. if( !isset( $ninja_forms_fields ) ) { 
  5. $ninja_forms_fields = array(); 
  6.  
  7. $defaults = array( 
  8. 'conditional' => '',  
  9. 'default_label' => '',  
  10. 'default_label_pos' => '',  
  11. 'default_value' => '',  
  12. 'display_function' => '',  
  13. 'display_label' => true,  
  14. 'display_wrap' => true,  
  15. 'edit_autocomplete_off' => false,  
  16. 'edit_conditional' => true,  
  17. 'edit_custom_class' => true,  
  18. 'edit_function' => '',  
  19. 'edit_help' => true,  
  20. 'edit_label' => true,  
  21. 'edit_label_pos' => true,  
  22. 'edit_meta' => true,  
  23. 'edit_options' => '',  
  24. 'edit_placeholder' => false,  
  25. 'edit_req' => true,  
  26. 'edit_settings' => '',  
  27. 'edit_sub_post_process' => '',  
  28. 'edit_sub_pre_process' => '',  
  29. 'edit_sub_process' => '',  
  30. 'esc_html' => true,  
  31. 'group' => '',  
  32. 'interact' => true,  
  33. 'label_pos_options' => '',  
  34. 'li_class' => '',  
  35. 'limit' => '',  
  36. 'name' => $slug,  
  37. 'nesting' => false,  
  38. 'post_process' => '',  
  39. 'pre_process' => '',  
  40. 'process' => '',  
  41. 'process_field' => true,  
  42. 'req' => false,  
  43. 'req_validation' => '',  
  44. 'save_function' => '',  
  45. 'save_sub' => true,  
  46. 'show_fav' => true,  
  47. 'show_field_id' => true,  
  48. 'show_remove' => true,  
  49. 'sub_edit' => 'text',  
  50. 'sub_edit_function' => '',  
  51. 'use_li' => true,  
  52. 'visible' => 1,  
  53. ); 
  54.  
  55. // Parse incomming $args into an array and merge it with $defaults 
  56. $args = wp_parse_args( $args, $defaults ); 
  57.  
  58. foreach( $args as $key => $val ) { 
  59. $ninja_forms_fields[$slug][$key] = $val; 
  60.