Fix notice template overwrites (#43506)
* Fix notice template overwrites * Add changefile(s) from automation for the following project(s): woocommerce * Bump template versions * Changing template version numbers to 8.5.0 as they haven’t been touched --------- Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
parent
47e1f50ae2
commit
780196a5b0
|
@ -0,0 +1,4 @@
|
|||
Significance: major
|
||||
Type: fix
|
||||
|
||||
Fixed a bug that prevented notice templates from being overwritten.
|
|
@ -42,7 +42,6 @@ class Notices {
|
|||
*/
|
||||
public function init() {
|
||||
add_filter( 'woocommerce_kses_notice_allowed_tags', [ $this, 'add_kses_notice_allowed_tags' ] );
|
||||
add_filter( 'wc_get_template', [ $this, 'get_notices_template' ], 10, 5 );
|
||||
add_action( 'wp_head', [ $this, 'enqueue_notice_styles' ] );
|
||||
}
|
||||
|
||||
|
@ -69,28 +68,6 @@ class Notices {
|
|||
return array_merge( $allowed_tags, $svg_args );
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces core notice templates with those from blocks.
|
||||
*
|
||||
* The new notice templates match block components with matching icons and styling. The only difference is that core
|
||||
* only has notices for info, success, and error notices, whereas blocks has notices for info, success, error,
|
||||
* warning, and a default notice type.
|
||||
*
|
||||
* @param string $template Located template path.
|
||||
* @param string $template_name Template name.
|
||||
* @param array $args Template arguments.
|
||||
* @param string $template_path Template path.
|
||||
* @param string $default_path Default path.
|
||||
* @return string
|
||||
*/
|
||||
public function get_notices_template( $template, $template_name, $args, $template_path, $default_path ) {
|
||||
if ( in_array( $template_name, $this->notice_templates, true ) ) {
|
||||
$template = $this->package->get_path( 'templates/' . $template_name );
|
||||
wp_enqueue_style( 'wc-blocks-style' );
|
||||
}
|
||||
return $template;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces all notices with the new block based notices.
|
||||
*
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
*
|
||||
* @see https://docs.woocommerce.com/document/template-structure/
|
||||
* @package WooCommerce\Templates
|
||||
* @version 8.5.0-dev
|
||||
* @version 8.5.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
|
@ -32,7 +32,7 @@ $multiple = count( $notices ) > 1;
|
|||
</svg>
|
||||
<div class="wc-block-components-notice-banner__content">
|
||||
<?php if ( $multiple ) { ?>
|
||||
<p class="wc-block-components-notice-banner__summary"><?php esc_html_e( 'The following problems were found:', 'woo-gutenberg-products-block' ); ?></p>
|
||||
<p class="wc-block-components-notice-banner__summary"><?php esc_html_e( 'The following problems were found:', 'woocommerce' ); ?></p>
|
||||
<ul>
|
||||
<?php foreach ( $notices as $notice ) : ?>
|
||||
<li<?php echo wc_get_notice_data_attr( $notice ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
*
|
||||
* @see https://docs.woocommerce.com/document/template-structure/
|
||||
* @package WooCommerce\Templates
|
||||
* @version 8.5.0-dev
|
||||
* @version 8.5.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
*
|
||||
* @see https://docs.woocommerce.com/document/template-structure/
|
||||
* @package WooCommerce\Templates
|
||||
* @version 8.5.0-dev
|
||||
* @version 8.5.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
|
|
Loading…
Reference in New Issue