/deprecated/includes/display/fields/field-error-message.php

  1. <?php if ( ! defined( 'ABSPATH' ) ) exit; 
  2. /** 
  3. * Outputs any error messages with the location of field_id. 
  4. **/ 
  5. add_action('init', 'ninja_forms_register_field_processing_error'); 
  6. function ninja_forms_register_field_processing_error() { 
  7. add_action('ninja_forms_display_before_closing_field_wrap', 'ninja_forms_display_field_processing_error'); 
  8.  
  9. function ninja_forms_display_field_processing_error( $field_id ) { 
  10. global $ninja_forms_processing; 
  11.  
  12. if( is_object( $ninja_forms_processing)) { 
  13.  
  14. $field_errors = $ninja_forms_processing->get_errors_by_location($field_id); 
  15. if ( $field_errors ) { 
  16. $style = ''; 
  17. } else { 
  18. $style = 'display:none;'; 
  19.  
  20. }else{ 
  21. $field_errors = ''; 
  22. $style = 'display:none;'; 
  23.  
  24. $class = apply_filters( 'ninja_forms_display_field_processing_error_class', 'ninja-forms-field-error', $field_id ); 
  25.  
  26. ?> 
  27. <div id="ninja_forms_field_<?php echo $field_id;?>_error" style="<?php echo $style;?>" class="<?php echo $class; ?>"> 
  28. <?php 
  29. if(is_array($field_errors)) { 
  30. foreach($field_errors as $error) { 
  31. echo '<p>'.$error['msg'].'</p>'; 
  32. ?> 
  33. </div> 
  34. <?php 
.