Automattic\WooCommerce\EmailEditor\Engine\Templates

Templates::get_post_typespublicWC 1.0

This is a callback function for adding post_types property to templates rest api response.

Method of the class: Templates{}

No Hooks.

Returns

Array.

Usage

$Templates = new Templates();
$Templates->get_post_types( $response_object ): array;
$response_object(array) (required)
The rest API response object.

Templates::get_post_types() code WC 10.5.0

public function get_post_types( $response_object ): array {
	$template = $this->templates_registry->get_by_slug( $response_object['slug'] ?? '' );
	if ( $template ) {
		return $template->get_post_types();
	}

	return $response_object['post_types'] ?? array();
}