Tribe_Meta_Box::__construct( $meta_box )


Source

File: lib/tribe-meta-box.php

	public function __construct( $meta_box ) {
		// run script only in admin area
		if ( ! is_admin() ) {
			return;
		}

		// assign meta box values to local variables and add it's missed values
		$this->_meta_box = $meta_box;
		// Cast pages to array
		$this->_meta_box['pages'] = (array) $meta_box['pages'];
		$this->_fields = $this->_meta_box['fields'];
		$this->add_missed_values();
		$this->register_scripts_and_styles();

		add_action( 'add_meta_boxes', array( $this, 'add' ) );	// add meta box, using 'add_meta_boxes' for WP 3.0+
		add_action( 'save_post', array( $this, 'save' ) );		// save meta box's data

		// check for some special fields and add needed actions for them
		$this->check_field_upload();
		$this->check_field_color();
		$this->check_field_date();
		$this->check_field_time();

		// load common js, css files
		// must enqueue for all pages as we need js for the media upload, too
		add_action( 'admin_enqueue_scripts', array( __CLASS__, 'js_css' ) );
	}