ninja_forms_edit_field_output_li

The Ninja Forms ninja forms edit field output li function.

Description

ninja_forms_edit_field_output_li( $field_id, (bool) $new = false ); 

Parameters (2)

0. $field_id
The field id.
1. $new — Optional. (bool) => false
The new.

Usage

  1. if ( !function_exists( 'ninja_forms_edit_field_output_li' ) ) { 
  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 new. 
  8. $new = false; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = ninja_forms_edit_field_output_li($field_id, $new); 
  12.  

Defined (1)

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

/deprecated/includes/admin/edit-field/li.php  
  1. function ninja_forms_edit_field_output_li( $field_id, $new = false ) { 
  2. global $wpdb, $ninja_forms_fields, $nf_rte_editors; 
  3. $field_row = ninja_forms_get_field_by_id( $field_id ); 
  4. $current_tab = ninja_forms_get_current_tab(); 
  5. if ( isset ( $_REQUEST['page'] ) ) { 
  6. $current_page = esc_html( $_REQUEST['page'] ); 
  7. } else { 
  8. $current_page = ''; 
  9.  
  10. $field_type = $field_row['type']; 
  11. $field_data = $field_row['data']; 
  12. $plugin_settings = nf_get_settings(); 
  13.  
  14. if ( isset( $ninja_forms_fields[$field_type]['use_li'] ) && $ninja_forms_fields[$field_type]['use_li'] ) { 
  15.  
  16. if ( isset( $field_row['fav_id'] ) && $field_row['fav_id'] != 0 ) { 
  17. $fav_id = $field_row['fav_id']; 
  18. $fav_row = ninja_forms_get_fav_by_id( $fav_id ); 
  19. if ( empty( $fav_row['name'] ) ) { 
  20. $args = array( 
  21. 'update_array' => array( 
  22. 'fav_id' => '',  
  23. ),  
  24. 'where' => array( 
  25. 'id' => $field_id,  
  26. ),  
  27. ); 
  28.  
  29. $fav_id = ''; 
  30. } else { 
  31. $fav_id = ''; 
  32.  
  33. if ( isset( $field_row['def_id'] ) && $field_row['def_id'] != 0 ) { 
  34. $def_id = $field_row['def_id']; 
  35. } else { 
  36. $def_id = ''; 
  37.  
  38. $form_id = $field_row['form_id']; 
  39.  
  40. if ( isset( $ninja_forms_fields[$field_type] ) ) { 
  41. $reg_field = $ninja_forms_fields[$field_type]; 
  42. $type_name = $reg_field['name']; 
  43. $edit_function = $reg_field['edit_function']; 
  44. $edit_options = $reg_field['edit_options']; 
  45. $li_class = $reg_field['li_class']; 
  46.  
  47. if ( $reg_field['nesting'] ) { 
  48. $nesting_class = 'ninja-forms-nest'; 
  49. } else { 
  50. $nesting_class = 'ninja-forms-no-nest'; 
  51. $conditional = $reg_field['conditional']; 
  52.  
  53. $type_class = $field_type.'-li'; 
  54.  
  55. if ( $def_id != 0 && $def_id != '' ) { 
  56. $def_row = ninja_forms_get_def_by_id( $def_id ); 
  57. if ( !empty( $def_row['name'] ) ) { 
  58. $type_name = $def_row['name']; 
  59.  
  60. if ( $fav_id != 0 && $fav_id != '' ) { 
  61. $fav_row = ninja_forms_get_fav_by_id( $fav_id ); 
  62. if ( !empty( $fav_row['name'] ) ) { 
  63. $fav_class = 'ninja-forms-field-remove-fav'; 
  64. $type_name = $fav_row['name']; 
  65. } else { 
  66. $fav_class = 'ninja-forms-field-add-fav'; 
  67.  
  68. if ( isset( $field_data['label'] ) && $field_data['label'] != '' ) { 
  69. $li_label = $field_data['label']; 
  70. } else { 
  71. $li_label = $type_name; 
  72.  
  73. $li_label = apply_filters( 'ninja_forms_edit_field_li_label', $li_label, $field_id ); 
  74.  
  75. $li_label = stripslashes( $li_label ); 
  76. $li_label = ninja_forms_esc_html_deep( $li_label ); 
  77.  
  78. if ( 
  79. isset( $reg_field ) && 
  80. isset( $reg_field['conditional'] ) && 
  81. isset( $reg_field['conditional']['value'] ) && 
  82. isset( $reg_field['conditional']['value']['type'] ) ) { 
  83. $conditional_value_type = $reg_field['conditional']['value']['type']; 
  84. } else { 
  85. $conditional_value_type = ''; 
  86. ?> 
  87. <li id="ninja_forms_field_<?php echo $field_id;?>" class="<?php echo $li_class; ?> <?php echo $nesting_class;?> <?php echo $type_class;?>"> 
  88. <input type="hidden" id="ninja_forms_field_<?php echo $field_id;?>_conditional_value_type" value="<?php echo $conditional_value_type;?>"> 
  89. <input type="hidden" id="ninja_forms_field_<?php echo $field_id;?>_fav_id" name="" class="ninja-forms-field-fav-id" value="<?php echo $fav_id;?>"> 
  90. <dl class="menu-item-bar"> 
  91. <dt class="menu-item-handle" id="ninja_forms_metabox_field_<?php echo $field_id;?>" > 
  92. <span class="item-title ninja-forms-field-title" id="ninja_forms_field_<?php echo $field_id;?>_title"><?php echo $li_label;?></span> 
  93. <span class="item-controls"> 
  94. <span class="item-type"><span class="spinner" style="margin-top:-2px;float:left;"></span><span class="item-type-name"><?php echo $type_name;?></span></span> 
  95. <a class="item-edit nf-edit-field" id="ninja_forms_field_<?php echo $field_id;?>_toggle" title="<?php _e( 'Edit Menu Item', 'ninja-forms' ); ?>" href="#" data-field="<?php echo $field_id; ?>"><?php _e( 'Edit Menu Item' , 'ninja-forms' ); ?></a> 
  96. </span> 
  97. </dt> 
  98. </dl> 
  99. <?php 
  100. if ( $new ) { 
  101. $padding = ''; 
  102. } else { 
  103. $padding = 'no-padding'; 
  104. ?> 
  105. <div class="menu-item-settings type-class inside <?php echo $padding?>" id="ninja_forms_field_<?php echo $field_id;?>_inside" > 
  106. <?php 
  107. if ( $new ) { 
  108. } else { 
  109. if ( isset( $ninja_forms_fields[$field_type] ) ) { 
  110. $reg_field = $ninja_forms_fields[$field_type]; 
  111. $edit_function = $reg_field['edit_function']; 
  112. $arguments = array(); 
  113. $arguments['field_id'] = $field_id; 
  114. $arguments['data'] = $field_data; 
  115.  
  116. if ( $edit_function != '' ) { 
  117. call_user_func_array( $edit_function, $arguments );