Calculations.php 769 B

1234567891011121314151617181920212223242526
  1. <?php if ( ! defined( 'ABSPATH' ) ) exit;
  2. final class NF_Admin_Metaboxes_Calculations extends NF_Abstracts_SubmissionMetabox
  3. {
  4. public function __construct()
  5. {
  6. // Only load if we are editing a post.
  7. if( ! isset( $_GET[ 'post' ] ) ) return;
  8. parent::__construct();
  9. $this->_title = __( 'Calculations', 'ninja-forms' );
  10. if( $this->sub && ! $this->sub->get_extra_value( 'calculations' ) ){
  11. remove_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) );
  12. }
  13. }
  14. public function render_metabox( $post, $metabox )
  15. {
  16. $data = $this->sub->get_extra_values( array( 'calculations' ) );
  17. Ninja_Forms::template( 'admin-metaboxes-calcs.html.php', $data[ 'calculations' ] );
  18. }
  19. }