ninja_forms_edit_field_desc

The Ninja Forms ninja forms edit field desc function.

Description

ninja_forms_edit_field_desc( $field_id, $field_data ); 

Parameters (2)

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

Usage

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

Defined (1)

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

/deprecated/includes/admin/edit-field/desc.php  
  1. function ninja_forms_edit_field_desc( $field_id, $field_data ) { 
  2. global $ninja_forms_fields; 
  3. $field_row = ninja_forms_get_field_by_id( $field_id ); 
  4. $field_type = $field_row['type']; 
  5. $reg_field = $ninja_forms_fields[$field_type]; 
  6. if ( isset ( $reg_field['edit_desc'] ) ) { 
  7. $edit_desc = $reg_field['edit_desc']; 
  8. } else { 
  9. $edit_desc = true; 
  10.  
  11. if ( $edit_desc ) { 
  12. if ( isset( $field_data['desc_text'] ) ) { 
  13. $desc_text = $field_data['desc_text']; 
  14. } else { 
  15. $desc_text = ''; 
  16.  
  17. if ( isset( $field_data['show_desc'] ) ) { 
  18. $show_desc = $field_data['show_desc']; 
  19. } else { 
  20. $show_desc = ''; 
  21.  
  22. if ( $show_desc == 1 ) { 
  23. $display_span = ''; 
  24. } else { 
  25. $display_span = ' style="display:none;"'; 
  26.  
  27. if ( !isset ( $desc_pos_options ) or $desc_pos_options == '' ) { 
  28.  
  29. $options = array(); 
  30. $options[] = array( 'name' => __( 'None', 'ninja-forms' ), 'value' => 'none' ); 
  31. $options[] = array( 'name' => __( 'Before Everything', 'ninja-forms' ), 'value' => 'before_everything' ); 
  32. if ( '_submit' != $field_type ) { 
  33. $options[] = array( 'name' => __( 'Before Label', 'ninja-forms' ), 'value' => 'before_label' ); 
  34. $options[] = array( 'name' => __( 'After Label', 'ninja-forms' ), 'value' => 'after_label' ); 
  35. $options[] = array( 'name' => __( 'After Everything', 'ninja-forms' ), 'value' => 'after_everything' ); 
  36.  
  37. } else { 
  38. $options = $desc_pos_options; 
  39.  
  40. $desc_desc = sprintf( __( 'If "desc text" is enabled, there will be a question mark %s placed next to the input field. Hovering over this question mark will show the desc text.', 'ninja-forms' ), '<img src="'.NINJA_FORMS_URL.'images/question-ico.gif">' ); 
  41. ninja_forms_edit_field_el_output( $field_id, 'checkbox', __( 'Add Description', 'ninja-forms' ), 'show_desc', $show_desc, 'wide', '', 'ninja-forms-show-desc' ); 
  42. ?> 
  43. <span id="ninja_forms_field_<?php echo $field_id;?>_desc_span" <?php echo $display_span;?>> 
  44. <?php 
  45. if ( isset( $field_data['desc_pos'] ) ) { 
  46. $desc_pos = $field_data['desc_pos']; 
  47. } else { 
  48. $desc_pos = ''; 
  49. ninja_forms_edit_field_el_output( $field_id, 'select', __( 'Description Position', 'ninja-forms' ), 'desc_pos', $desc_pos, 'wide', $options, 'wide' ); 
  50. ninja_forms_edit_field_el_output( $field_id, 'rte', __( 'Description Content', 'ninja-forms' ), 'desc_text', $desc_text, 'wide', '', 'widefat' ); 
  51.  
  52. ?> 
  53. </span> 
  54. <?php