MailPoet\EmailEditor\Engine\Templates

Templates::get_post_types()publicWC 1.0

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

Method of the class: Templates{}

No Hooks.

Return

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 9.8.1

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();
}