ninja_forms_display_label_inside

The Ninja Forms ninja forms display label inside function.

Description

ninja_forms_display_label_inside( $data, $field_id ); 

Parameters (2)

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

Usage

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

Defined (1)

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

/deprecated/includes/display/fields/label.php  
  1. function ninja_forms_display_label_inside( $data, $field_id ) { 
  2. global $ninja_forms_loading, $ninja_forms_processing; 
  3.  
  4. if ( isset ( $ninja_forms_loading ) ) { 
  5. $user_value = $ninja_forms_loading->get_field_value( $field_id ); 
  6. $field_row = $ninja_forms_loading->get_field_settings( $field_id ); 
  7. } else if ( isset ( $ninja_forms_processing ) ) { 
  8. $user_value = $ninja_forms_processing->get_field_value( $field_id ); 
  9. $field_row = $ninja_forms_processing->get_field_settings( $field_id ); 
  10.  
  11. if ( isset ( $field_row['type'] ) ) { 
  12. $field_type = $field_row['type']; 
  13. } else { 
  14. $field_type = ''; 
  15.  
  16. if ( isset( $data['label_pos'] ) ) { 
  17. $label_pos = $data['label_pos']; 
  18. } else { 
  19. $label_pos = ''; 
  20.  
  21. // Get the required field symbol. 
  22. $settings = nf_get_settings(); 
  23. if ( isset ( $settings['req_field_symbol'] ) ) { 
  24. $req_symbol = $settings['req_field_symbol']; 
  25. } else { 
  26. $req_symbol = '*'; 
  27.  
  28. if ( isset ( $data['req'] ) and $data['req'] == 1 and $label_pos == 'inside' and ! isset ( $data['req_added'] ) ) { 
  29. $data['label'] .= ' '.$req_symbol; 
  30. $data['req_added'] = 1; 
  31.  
  32. if ( isset( $data['label'] ) ) { 
  33. $label = $data['label']; 
  34. } else { 
  35. $label = ''; 
  36.  
  37. if ( $field_type != '_list' ) { 
  38. if ( $label_pos == 'inside' ) { 
  39. $label = strip_tags( $label ); 
  40.  
  41. $data['label'] = $label;  
  42. if ( isset ( $ninja_forms_loading ) ) { 
  43. if ( !empty( $user_value ) ) 
  44. return $data; 
  45. $ninja_forms_loading->update_field_value( $field_id, $label ); 
  46. } else { 
  47. if ( $ninja_forms_processing->get_field_value( $field_id ) ) 
  48. return $data; 
  49. $ninja_forms_processing->update_field_value( $field_id, $label ); 
  50.  
  51. return $data;