nf_all_fields_shortcode

Shortcode for ninja_forms_all_fields.

Description

(string) nf_all_fields_shortcode( $atts, (string) $content = '' ); 

Returns (string)

$content

Parameters (2)

0. $atts
The atts.
1. $content — Optional. (string) => ''
The content.

Usage

  1. if ( !function_exists( 'nf_all_fields_shortcode' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'ninja-forms/deprecated/includes/shortcode.php'; 
  3.  
  4. // The atts. 
  5. $atts = null; 
  6.  
  7. // The content. 
  8. $content = ''; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = nf_all_fields_shortcode($atts, $content); 
  12.  

Defined (1)

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

/deprecated/includes/shortcode.php  
  1. function nf_all_fields_shortcode( $atts, $content = '' ) { 
  2. global $ninja_forms_fields, $ninja_forms_processing; 
  3.  
  4. if ( ! isset ( $ninja_forms_processing ) ) 
  5. return false; 
  6.  
  7. $html = isset ( $atts['html'] ) ? $atts['html'] : 1; 
  8.  
  9. if ( 1 == $html ) { 
  10. // Generate our "all fields" table for use as a JS var. 
  11. $field_list = '<table><tbody>'; 
  12. } else { 
  13. $field_list = ''; 
  14. foreach ( $ninja_forms_processing->get_all_fields() as $field_id => $user_value ) { 
  15. if ( ! $user_value ) 
  16. continue; 
  17.  
  18. $field = $ninja_forms_processing->get_field_settings( $field_id ); 
  19. $type = $field['type']; 
  20. if ( ! isset ( $ninja_forms_fields[ $type ] ) || ! $ninja_forms_fields[ $type ]['process_field'] ) 
  21. continue; 
  22.  
  23. $value = apply_filters( 'nf_all_fields_field_value', ninja_forms_field_shortcode( array( 'id' => $field_id ) ), $field_id ); 
  24.  
  25. if( isset( $field[ 'data' ][ 'admin_label' ] ) && $field[ 'data' ][ 'admin_label' ] ) { 
  26. $label = $field[ 'data' ][ 'admin_label' ]; 
  27. } else { 
  28. $label = $field['data']['label']; 
  29. $label = strip_tags( apply_filters( 'nf_all_fields_field_label', $label, $field_id ) ); 
  30.  
  31. if ( 1 == $html ) { 
  32. $field_list .= '<tr id="ninja_forms_field_' . $field_id . '"><td>' . $label .':</td><td>' . $value . '</td></tr>'; 
  33. } else { 
  34. $field_list .= $label . ' - ' . $value . "\r\n"; 
  35.  
  36. if ( 1 == $html ) 
  37. $field_list .= '</tbody></table>'; 
  38.  
  39. return apply_filters( 'nf_all_fields_table', $field_list, $ninja_forms_processing->get_form_ID() ); 
  40.