NF_Abstracts_Metabox

The Ninja Forms NF Abstracts Metabox class.

Defined (1)

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

/includes/Abstracts/Metabox.php  
  1. abstract class NF_Abstracts_Metabox 
  2. protected $_id = ''; // Dynamically set in constructor using the class name. 
  3.  
  4. protected $_title = ''; // Should be set (and translated) in the constructor. 
  5.  
  6. protected $_callback = 'render_metabox'; 
  7.  
  8. protected $_post_types = array(); 
  9.  
  10. protected $_context = 'side'; 
  11.  
  12. protected $_priority = 'default'; 
  13.  
  14. protected $_callback_args = array(); 
  15.  
  16. protected $_capability = 'edit_post'; 
  17.  
  18. public function __construct() 
  19. $this->_id = strtolower( get_class( $this ) ); 
  20.  
  21. $this->_title = __( 'Metabox', 'ninja-forms' ); 
  22.  
  23. add_action( 'save_post', array( $this, '_save_post' ) ); 
  24.  
  25. add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) ); 
  26.  
  27. public function add_meta_boxes() 
  28. add_meta_box( 
  29. $this->_id,  
  30. $this->_title,  
  31. array( $this, $this->_callback ),  
  32. $this->_post_types,  
  33. $this->_context,  
  34. $this->_priority,  
  35. $this->_callback_args 
  36. ); 
  37.  
  38. abstract public function render_metabox( $post, $metabox ); 
  39.  
  40. public function _save_post( $post_id ) 
  41. // If this is an autosave, our form has not been submitted, so we don't want to do anything. 
  42. if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return; 
  43.  
  44. $this->save_post( $post_id ); 
  45.  
  46. protected function save_post( $post_id ) 
  47. // This section intentionally left blank.