Automattic\WooCommerce\EmailEditor\Engine\Templates
Templates_Registry::get_by_slug
Retrieve a template by its slug. Example: get_by_slug( 'email-general' ) will return the instance of Template with identical slug.
Метод класса: Templates_Registry{}
Хуков нет.
Возвращает
Template|null. The template object or null if not found.
Использование
$Templates_Registry = new Templates_Registry(); $Templates_Registry->get_by_slug( $slug ): ?Template;
- $slug(строка) (обязательный)
- The slug of the template.
Код Templates_Registry::get_by_slug() Templates Registry::get by slug WC 11.2.2
public function get_by_slug( string $slug ): ?Template {
foreach ( $this->templates as $template ) {
if ( $template->get_slug() === $slug ) {
return $template;
}
}
return null;
}