Skip to content

Commit

Permalink
Merge pull request #2 from deucecreative/master
Browse files Browse the repository at this point in the history
Declare support for PHP 8 and fix issue #3
  • Loading branch information
smarteist committed Mar 3, 2021
2 parents 99f09ca + b2b408e commit 0951016
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
}
],
"require": {
"php": "^7.2",
"php": "^7.2|^8.0",
"roots/acorn": "*"
},
"require-dev": {
Expand Down
2 changes: 1 addition & 1 deletion src/Providers/WooCommerceServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function bindFilters()

add_filter('template_include', [$woocommerce, 'templateInclude'], 100, 1);
add_filter('comments_template', [$woocommerce, 'templateInclude'], 100, 1);
add_filter('woocommerce_locate_template', [$woocommerce, 'templatePart'], PHP_INT_MAX, 1);
add_filter('woocommerce_locate_template', [$woocommerce, 'locateTemplate'], PHP_INT_MAX, 2);
add_filter('wc_get_template_part', [$woocommerce, 'templatePart'], PHP_INT_MAX, 1);
add_filter('wc_get_template', [$woocommerce, 'getTemplate'], 100, 3);

Expand Down
15 changes: 13 additions & 2 deletions src/WooCommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,28 @@ public function getTemplate(string $template, string $templateName, array $args)
}

/**
* @hooked woocommerce_locate_template
* @hooked wc_get_template_part
* Filter all template parts that available in overrides and return our blade
* template loaders as needed.
* @param string $template part to find
* @return string loader output
*/
public function templatePart(string $template)
{
return $this->locateTemplate($template, $template);
}

/**
* @hooked woocommerce_locate_template
* Filter all template parts that available in overrides and return our blade
* template loaders as needed.
* @param string $template part to find
* @return string loader output
*/
public function locateTemplate(string $template, string $template_name)
{
// Locate any matching template within the theme.
$themeTemplate = $this->locateThemeTemplate($template);
$themeTemplate = $this->locateThemeTemplate($template_name);

// Include directly unless it's a blade file.
if (
Expand Down

0 comments on commit 0951016

Please sign in to comment.