ninja_forms_display_req_items

The Ninja Forms ninja forms display req items function.

Description

ninja_forms_display_req_items( $form_id ); 

Parameters (1)

0. $form_id
The form id.

Usage

  1. if ( !function_exists( 'ninja_forms_display_req_items' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'ninja-forms/deprecated/includes/display/form/required-label.php'; 
  3.  
  4. // The form id. 
  5. $form_id = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = ninja_forms_display_req_items($form_id); 
  9.  

Defined (1)

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

/deprecated/includes/display/form/required-label.php  
  1. function ninja_forms_display_req_items( $form_id ) { 
  2. $plugin_settings = nf_get_settings(); 
  3. if(isset($plugin_settings['req_div_label'])) { 
  4. $req_div_label = __( $plugin_settings['req_div_label'], 'ninja-forms' ); 
  5. }else{ 
  6. $req_div_label = __('Fields marked with a * are required.', 'ninja-forms'); 
  7.  
  8. $all_fields = ninja_forms_get_fields_by_form_id( $form_id ); 
  9. $output = false; 
  10. if( is_array( $all_fields ) AND !empty( $all_fields ) ) { 
  11. foreach( $all_fields as $field ) { 
  12. if( isset( $field['data']['req'] ) AND $field['data']['req'] == 1 ) { 
  13. $output = true; 
  14. if( $output && $req_div_label != '' ) { 
  15. $class = apply_filters( 'ninja_forms_display_required_items_class', 'ninja-forms-required-items', $form_id ); 
  16. ?> 
  17. <div class="<?php echo $class; ?>"><?php echo $req_div_label;?></div> 
  18. <?php