/** * Snapshot_REST_API_Controller constructor. * * @throws Exception If the post type was not registered properly. * @param string $post_type Post type. */ public function __construct($post_type) { $post_type_obj = get_post_type_object($post_type); if (empty($post_type_obj) || empty($post_type_obj->customize_snapshot_post_type_obj)) { throw new Exception('Missing customize_snapshot post type obj or arg for customize_snapshot_post_type_obj'); } $this->snapshot_post_type = $post_type_obj->customize_snapshot_post_type_obj; parent::__construct($post_type); }
public function __construct($post_type) { parent::__construct($post_type); $this->post_type = $post_type; $this->register_routes(); $this->add_update_attribute_hooks(); $this->add_rooftop_link_filters(); $this->add_rooftop_rest_presentation_filters(); }
function __construct() { parent::__construct('post'); }