ninja_forms_register_field_checkbox

The Ninja Forms ninja forms register field checkbox function.

Description

ninja_forms_register_field_checkbox(); 

Usage

  1. if ( !function_exists( 'ninja_forms_register_field_checkbox' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'ninja-forms/deprecated/includes/fields/checkbox.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = ninja_forms_register_field_checkbox(); 
  7.  

Defined (1)

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

/deprecated/includes/fields/checkbox.php  
  1. function ninja_forms_register_field_checkbox() { 
  2. $args = array( 
  3. 'name' => __( 'Checkbox', 'ninja-forms' ),  
  4. 'edit_options' => array( 
  5. array( 
  6. 'type' => 'select', //What type of input should this be? 
  7. 'options' => array( 
  8. array( 
  9. 'name' => __( 'Unchecked', 'ninja-forms' ),  
  10. 'value' => 'unchecked',  
  11. ),  
  12. array( 
  13. 'name' => __( 'Checked', 'ninja-forms' ),  
  14. 'value' => 'checked',  
  15. ),  
  16. ),  
  17. 'name' => 'default_value', //What should it be named. This should always be a programmatic name, not a label. 
  18. 'label' => __( 'Default Value', 'ninja-forms' ),  
  19. 'class' => 'widefat', //Additional classes to be added to the input element. 
  20. ),  
  21. ),  
  22. //'edit_function' => 'ninja_forms_field_checkbox_edit',  
  23. 'display_function' => 'ninja_forms_field_checkbox_display',  
  24. 'group' => 'standard_fields',  
  25. 'edit_label' => true,  
  26. 'edit_label_pos' => true,  
  27. 'label_pos_options' => array( 
  28. array('name' => __( 'Left of Element', 'ninja-forms' ), 'value' => 'left'),  
  29. array('name' => __( 'Above Element', 'ninja-forms' ), 'value' => 'above'),  
  30. array('name' => __( 'Below Element', 'ninja-forms' ), 'value' => 'below'),  
  31. array('name' => __( 'Right of Element', 'ninja-forms' ), 'value' => 'right'),  
  32. ),  
  33. 'edit_req' => true,  
  34. 'edit_custom_class' => true,  
  35. 'edit_help' => true,  
  36. 'edit_desc' => true,  
  37. 'edit_meta' => false,  
  38. 'sidebar' => 'template_fields',  
  39. 'edit_conditional' => true,  
  40. 'conditional' => array( 
  41. 'action' => array( 
  42. 'show' => array( 
  43. 'name' => __( 'Show This', 'ninja-forms' ),  
  44. 'js_function' => 'show',  
  45. 'output' => 'show',  
  46. ),  
  47. 'hide' => array( 
  48. 'name' => __( 'Hide This', 'ninja-forms' ),  
  49. 'js_function' => 'hide',  
  50. 'output' => 'hide',  
  51. ),  
  52. 'change_value' => array( 
  53. 'name' => __( 'Change Value', 'ninja-forms' ),  
  54. 'output' => 'select',  
  55. 'options' => array( 
  56. 'Checked' => 'checked',  
  57. 'Unchecked' => 'unchecked',  
  58. ),  
  59. 'js_function' => 'change_value',  
  60.  
  61. ),  
  62.  
  63. ),  
  64. 'value' => array( 
  65. 'type' => 'select',  
  66. 'options' => array( 
  67. 'Checked' => 'checked',  
  68. 'Unchecked' => 'unchecked',  
  69. ),  
  70. ),  
  71. ),  
  72. 'req_validation' => 'ninja_forms_field_checkbox_validation',  
  73. 'edit_sub_value' => 'nf_field_checkbox_edit_sub_value',  
  74. ); 
  75.  
  76. ninja_forms_register_field('_checkbox', $args);