cf_si_meta_data

Function formats the meta data for viewing in the item modal This is just a copy of the history portion of the template.

Description

cf_si_meta_data( $meta, $form ); 

Parameters (2)

0. $meta
The meta.
1. $form
The form.

Usage

  1. if ( !function_exists( 'cf_si_meta_data' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'caldera-forms-sprout-invoices-integration/cf-sprout-invoice.php'; 
  3.  
  4. // The meta. 
  5. $meta = null; 
  6.  
  7. // The form. 
  8. $form = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = cf_si_meta_data($meta, $form); 
  12.  

Defined (1)

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

/cf-sprout-invoice.php  
  1. function cf_si_meta_data($meta, $form) { 
  2. $estimate = get_post( $meta['meta_value'] ); 
  3. if( empty( $estimate ) ) { 
  4. $meta[error] = __('Estimate invalid or has been deleted'); 
  5. return $meta; 
  6. if($meta['meta_key'] == 'estimate_id') { 
  7. $meta['title'] = __('Estimate', 'cf-sprout'); 
  8. }else if($meta['meta_key'] == 'invoice_id') { 
  9. $meta['title'] = __('Invoice', 'cf-sprout'); 
  10.  
  11. $meta['view_link'] = get_permalink( $estimate->ID ); 
  12. $meta['edit_link'] = 'post.php?post=' . (int) $estimate->ID .'&action=edit'; 
  13.  
  14. ob_start(); 
  15. ?> 
  16. <div id="doc_history"> 
  17. <?php foreach ( si_doc_history_records( $meta['meta_value'] ) as $item_id => $data ): ?> 
  18. <dt> 
  19. <span class="history_status <?php echo $data['status_type'] ?>"><?php echo $data['type']; ?></span><br/> 
  20. <span class="history_date"><?php echo date( get_option( 'date_format' ).' @ '.get_option( 'time_format' ), strtotime( $data['post_date'] ) ) ?></span> 
  21. </dt> 
  22.  
  23. <dd> 
  24. <?php if ( $data['status_type'] == SI_Notifications::RECORD ): ?> 
  25. <p> 
  26. <?php echo $update_title ?> 
  27. <br/><a href="#TB_inline?width=600&height=380&inlineId=notification_message_<?php echo $item_id ?>" id="show_notification_tb_link_<?php echo $item_id ?>" class="thickbox tooltip notification_message" title="<?php si_e('View Message') ?>"><?php si_e('View Message') ?></a> 
  28. </p> 
  29. <div id="notification_message_<?php echo $item_id ?>" class="cloak"> 
  30. <?php echo apply_filters( 'the_content', $data['content'] ) ?> 
  31. </div> 
  32. <?php elseif ( $data['status_type'] == SI_Invoices::VIEWED_STATUS_UPDATE ) : ?> 
  33. <p> 
  34. <?php echo $data['update_title'] ?> 
  35. </p> 
  36. <?php else: ?> 
  37. <?php echo apply_filters( 'the_content', $data['content'] ) ?> 
  38. <?php endif ?> 
  39.  
  40. </dd> 
  41. <?php endforeach ?> 
  42. </div><!-- #doc_history --> 
  43. <?php 
  44. $meta['html'] = ob_get_clean(); 
  45.  
  46. return $meta;