Automattic\WooCommerce\Internal\Orders
OrderActionsRestController::get_email_template_by_id
Retrieve an email template class using its ID, if it is available.
Метод класса: OrderActionsRestController{}
Хуков нет.
Возвращает
WC_Email|null
. The email template class if it is available, otherwise null.
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_email_template_by_id( $template_id, ?array $available_templates ): ?WC_Email;
- $template_id(строка) (обязательный)
- The ID of the desired email template class.
- ?array $available_templates
- .
По умолчанию: null
Код OrderActionsRestController::get_email_template_by_id() OrderActionsRestController::get email template by id WC 9.9.4
private function get_email_template_by_id( string $template_id, ?array $available_templates = null ): ?WC_Email { if ( is_null( $available_templates ) ) { $available_templates = WC()->mailer()->emails; } $matching_templates = array_filter( $available_templates, fn( $template ) => $template->id === $template_id ); if ( empty( $matching_templates ) ) { return null; } return reset( $matching_templates ); }