nf_output_registered_field_settings

The Ninja Forms nf output registered field settings function.

Description

nf_output_registered_field_settings( $field_id, (array) $data = array() ); 

Parameters (2)

0. $field_id
The field id.
1. $data — Optional. (array) => array()
The data.

Usage

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

Defined (1)

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

/deprecated/includes/admin/edit-field/li.php  
  1. function nf_output_registered_field_settings( $field_id, $data = array() ) { 
  2. global $ninja_forms_fields, $nf_rte_editors; 
  3.  
  4. $field_row = ninja_forms_get_field_by_id( $field_id ); 
  5. $field_type = $field_row['type']; 
  6.  
  7. $field_data = empty ( $data ) ? $field_row['data'] : $data; 
  8.  
  9. $current_tab = ninja_forms_get_current_tab(); 
  10. if ( isset ( $_REQUEST['page'] ) ) { 
  11. $current_page = esc_html( $_REQUEST['page'] ); 
  12. } else { 
  13. $current_page = ''; 
  14.  
  15. $reg_field = $ninja_forms_fields[$field_type]; 
  16. $type_name = $reg_field['name']; 
  17. $edit_function = $reg_field['edit_function']; 
  18. $edit_options = $reg_field['edit_options']; 
  19. $edit_settings = $reg_field['edit_settings']; 
  20.  
  21. if ( $reg_field['nesting'] ) { 
  22. $nesting_class = 'ninja-forms-nest'; 
  23. } else { 
  24. $nesting_class = 'ninja-forms-no-nest'; 
  25. $conditional = $reg_field['conditional']; 
  26.  
  27.  
  28. if ( isset( $field_row['fav_id'] ) && $field_row['fav_id'] != 0 ) { 
  29. $fav_id = $field_row['fav_id']; 
  30. $fav_row = ninja_forms_get_fav_by_id( $fav_id ); 
  31. if ( empty( $fav_row['name'] ) ) { 
  32. $args = array( 
  33. 'update_array' => array( 
  34. 'fav_id' => '',  
  35. ),  
  36. 'where' => array( 
  37. 'id' => $field_id,  
  38. ),  
  39. ); 
  40.  
  41. $fav_id = ''; 
  42. } else { 
  43. $fav_id = ''; 
  44.  
  45. if ( isset( $field_row['def_id'] ) && $field_row['def_id'] != 0 ) { 
  46. $def_id = $field_row['def_id']; 
  47. } else { 
  48. $def_id = ''; 
  49.  
  50. if ( $fav_id != 0 && $fav_id != '' ) { 
  51. $fav_row = ninja_forms_get_fav_by_id( $fav_id ); 
  52. if ( !empty( $fav_row['name'] ) ) { 
  53. $fav_class = 'ninja-forms-field-remove-fav'; 
  54. $type_name = $fav_row['name']; 
  55. $icon_class = 'filled'; 
  56. } else { 
  57. $fav_class = 'ninja-forms-field-add-fav'; 
  58. $icon_class = 'empty'; 
  59.  
  60. if ( $reg_field['show_field_id'] || $reg_field['show_fav'] ) { 
  61. ?> 
  62. <table id="field-info"> 
  63. <tr> 
  64. <?php 
  65. if ( $reg_field['show_field_id'] ) { 
  66. ?> 
  67. <td width="65%"><?php _e( 'Field ID', 'ninja-forms' ); ?>: <strong><?php echo $field_id;?></strong></td> 
  68. <?php 
  69. ?> 
  70. <!-- <td width="15%"><a href="#" class="ninja-forms-field-add-def" id="ninja_forms_field_<?php echo $field_id;?>_def" class="ninja-forms-field-add-def">Add Defined</a></td><td width="15%"><a href="#" class="ninja-forms-field-remove-def" id="ninja_forms_field_<?php echo $field_id;?>_def">Remove Defined</a></td> --> 
  71. <?php 
  72. if ( $reg_field['show_fav'] ) { 
  73. ?> 
  74. <td width="5%"><a href="#" class="<?php echo $fav_class;?>" id="ninja_forms_field_<?php echo $field_id;?>_fav"><span class="dashicons dashicons-star-<?php echo $icon_class; ?>"></span></a></td> 
  75. <?php 
  76. ?> 
  77. </tr> 
  78. </table> 
  79. <?php 
  80. do_action( 'ninja_forms_edit_field_before_registered', $field_id, $field_data ); 
  81.  
  82. $arguments = array( 'field_id' => $field_id, 'data' => $field_data ); 
  83.  
  84. if ( $edit_function != '' ) { 
  85. call_user_func_array( $edit_function, $arguments ); 
  86.  
  87. /** 
  88. * We need to get a list of all of our RTEs. 
  89. * If we're submitting via ajax, we'll need to use this list. 
  90. */ 
  91. if ( ! isset ( $nf_rte_editors ) ) 
  92. $nf_rte_editors = array(); 
  93.  
  94. $editors = new NF_WP_Editor_Ajax(); 
  95.  
  96. if ( is_array( $edit_options ) and !empty( $edit_options ) ) { 
  97. foreach ( $edit_options as $opt ) { 
  98. $type = $opt['type']; 
  99.  
  100. $label_class = ''; 
  101.  
  102. if ( isset( $opt['label'] ) ) { 
  103. $label = $opt['label']; 
  104. } else { 
  105. $label = ''; 
  106.  
  107. if ( isset( $opt['name'] ) ) { 
  108. $name = $opt['name']; 
  109. } else { 
  110. $name = ''; 
  111.  
  112. if ( isset( $opt['width'] ) ) { 
  113. $width = $opt['width']; 
  114. } else { 
  115. $width = ''; 
  116.  
  117. if ( isset( $opt['options'] ) ) { 
  118. $options = $opt['options']; 
  119. } else { 
  120. $options = ''; 
  121.  
  122. if ( isset( $opt['class'] ) ) { 
  123. $class = $opt['class']; 
  124. } else { 
  125. $class = ''; 
  126.  
  127. if ( isset( $opt['default'] ) ) { 
  128. $default = $opt['default']; 
  129. } else { 
  130. $default = ''; 
  131.  
  132. if ( isset( $opt['desc'] ) ) { 
  133. $desc = $opt['desc']; 
  134. } else { 
  135. $desc = ''; 
  136.  
  137. if ( isset( $field_data[$name] ) ) { 
  138. $value = $field_data[$name]; 
  139. } else { 
  140. $value = $default; 
  141.  
  142. ninja_forms_edit_field_el_output( $field_id, $type, $label, $name, $value, $width, $options, $class, $desc, $label_class ); 
  143.  
  144. add_action( 'nf_edit_field_advanced', 'nf_test', 10, 2 ); 
  145.  
  146. $settings_sections = apply_filters( 'nf_edit_field_settings_sections', array( 
  147. 'restrictions' => __( 'Restriction Settings', 'ninja-forms' ),  
  148. 'calculations' => __( 'Calculation Settings', 'ninja-forms' ),  
  149. 'advanced' => __( 'Advanced Settings', 'ninja-forms' ),  
  150. ) ); 
  151.  
  152. foreach ( $settings_sections as $key => $name ) { 
  153. ?> 
  154. <div class="nf-field-settings description-wide description"> 
  155. <div class="title"> 
  156. <?php echo $name; ?><span class="dashicons dashicons-arrow-down nf-field-sub-section-toggle"></span> 
  157. </div> 
  158. <div class="inside" style="display:none;"> 
  159. <?php 
  160. if ( ! empty ( $edit_settings[ $key ] ) ) { 
  161. foreach ( $edit_settings[ $key ] as $opt ) { 
  162. $type = $opt['type']; 
  163.  
  164. $label_class = ''; 
  165.  
  166. if ( isset( $opt['label'] ) ) { 
  167. $label = $opt['label']; 
  168. } else { 
  169. $label = ''; 
  170.  
  171. if ( isset( $opt['name'] ) ) { 
  172. $name = $opt['name']; 
  173. } else { 
  174. $name = ''; 
  175.  
  176. if ( isset( $opt['width'] ) ) { 
  177. $width = $opt['width']; 
  178. } else { 
  179. $width = ''; 
  180.  
  181. if ( isset( $opt['options'] ) ) { 
  182. $options = $opt['options']; 
  183. } else { 
  184. $options = ''; 
  185.  
  186. if ( isset( $opt['class'] ) ) { 
  187. $class = $opt['class']; 
  188. } else { 
  189. $class = ''; 
  190.  
  191. if ( isset( $opt['default'] ) ) { 
  192. $default = $opt['default']; 
  193. } else { 
  194. $default = ''; 
  195.  
  196. if ( isset( $opt['desc'] ) ) { 
  197. $desc = $opt['desc']; 
  198. } else { 
  199. $desc = ''; 
  200.  
  201. if ( isset( $field_data[$name] ) ) { 
  202. $value = $field_data[$name]; 
  203. } else { 
  204. $value = $default; 
  205.  
  206. ninja_forms_edit_field_el_output( $field_id, $type, $label, $name, $value, $width, $options, $class, $desc, $label_class ); 
  207.  
  208. do_action( 'nf_edit_field_' . $key, $field_id, $field_data ); 
  209. ?> 
  210. </div> 
  211. </div> 
  212. <?php 
  213.  
  214. ?> 
  215. <div class="menu-item-actions description-wide submitbox"> 
  216. <a class="submitdelete deletion nf-remove-field" id="ninja_forms_field_<?php echo $field_id;?>_remove" data-field="<?php echo $field_id; ?>" href="#"><?php _e('Remove', 'ninja-forms'); ?></a> 
  217. </div> 
  218. <?php 
  219.  
  220. if ( ! empty ( $nf_rte_editors ) && isset ( $editors ) && is_object( $editors ) ) { 
  221. $editors->output_js( $field_id, $nf_rte_editors ); 
  222.