Automattic\WooCommerce\EmailEditor\Engine\Templates
Templates::get_post_types
This is a callback function for adding post_types property to templates rest api response.
Метод класса: Templates{}
Хуков нет.
Возвращает
array.
Использование
$Templates = new Templates(); $Templates->get_post_types( $response_object ): array;
- $response_object(массив) (обязательный)
- The rest API response object.
Код Templates::get_post_types() Templates::get post types WC 11.3.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();
}