Automattic\WooCommerce\Blocks\Domain\Services
Notices::get_notices_template()
Replaces core notice templates with those from blocks.
The new notice templates match block components with matching icons and styling. The differences are:
- Core has notices for info, success, and error notices, blocks has notices for info, success, error, warning, and a default notice type.
- The block notices use different CSS classes to the core notices. Core uses woocommerce-message, is-info and is-error classes, blocks uses wc-block-components-notice-banner is-error, wc-block-components-notice-banner is-info, and wc-block-components-notice-banner is-success.
- The markup of the notices is different, with the block notices using SVG icons and a slightly different structure to accommodate this.
Метод класса: Notices{}
Хуков нет.
Возвращает
Строку
.
Использование
$Notices = new Notices(); $Notices->get_notices_template( $template, $template_name, $args, $template_path, $default_path );
- $template(строка) (обязательный)
- Located template path.
- $template_name(строка) (обязательный)
- Template name.
- $args(массив) (обязательный)
- Template arguments.
- $template_path(строка) (обязательный)
- Template path.
- $default_path(строка) (обязательный)
- Default path.
Код Notices::get_notices_template() Notices::get notices template WC 9.6.0
public function get_notices_template( $template, $template_name, $args, $template_path, $default_path ) { if ( in_array( $template_name, $this->notice_templates, true ) ) { $directory = get_stylesheet_directory(); $file = $directory . '/woocommerce/' . $template_name; if ( file_exists( $file ) ) { return $file; } $template = $this->package->get_path( 'templates/block-' . $template_name ); wp_enqueue_style( 'wc-blocks-style' ); } return $template; }