bobbingwide / wizzie

Experimental WooCommerce Full Site Editing child theme of Fizzie
GNU General Public License v2.0
0 stars 0 forks source link

Various template part not found messages #13

Closed bobbingwide closed 11 months ago

bobbingwide commented 11 months ago

In woocommerce.wp-a2z.org I get Template part has been deleted or is unavailable: metadates when viewing https://woocommerce.wp-a2z.org/oik-plugins/woocommerce/

In woocommerce.wp.a2z I get

Template Part Not Found: search
slug: search
layout: 1
theme: wizzie
File path: C:\apache\htdocs\wp-a2z/wp-content/themes/wizzie/languages/en_GB/parts/search.html

and

Template Part Not Found: footer
slug: footer
theme: wizzie
File path: C:\apache\htdocs\wp-a2z/wp-content/themes/wizzie/languages/en_GB/parts/footer.html

on the home page. and a whole load of similar messages on https://woocommerce.wp.a2z/block/

Gutenberg version is 16.9.0

bobbingwide commented 11 months ago

I thought that the messages in wp.a2z could have been due to the fact that my locale was en_GB. But I got the same messages with en_US.

bobbingwide commented 11 months ago

In woocommerce.wp-a2z.org I get Template part has been deleted or is unavailable: metadates when viewing https://woocommerce.wp-a2z.org/oik-plugins/woocommerce/

I applied a temporary fix by changing the single-oik-plugins.html template to remove the "theme":"fizzie" attribute from the template-part tag for metadates. I didn't change single-oik-themes.html so this still produces the message.

bobbingwide commented 11 months ago

In my local environment I found that my block override logic in wizzie_maybe_override_block() wasn't working.

It would appear that $args['render_callback'] had already been overridden by WooCommerce with its own method.

    [0] => Array

        [render_callback] => Array

            [0] => Automattic\WooCommerce\Blocks\BlockTemplatesController Object

                [ Automattic\WooCommerce\Blocks\BlockTemplatesController package] => Automattic\WooCommerce\Blocks\Domain\Package Object

                    [ Automattic\WooCommerce\Blocks\Domain\Package version] => (string) "11.1.2"
                    [ Automattic\WooCommerce\Blocks\Domain\Package path] => (string) "C:\apache\htdocs\wordpress\wp-content\plugins\woocommerce\packages\woocommerce-blocks"
                    [ Automattic\WooCommerce\Blocks\Domain\Package plugin_dir_url] => (NULL) 
                    [ Automattic\WooCommerce\Blocks\Domain\Package feature_gating] => Automattic\WooCommerce\Blocks\Domain\Services\FeatureGating Object

                        [ Automattic\WooCommerce\Blocks\Domain\Services\FeatureGating flag] => (integer) 1
                        [ Automattic\WooCommerce\Blocks\Domain\Services\FeatureGating environment] => (string) "production"

                [ Automattic\WooCommerce\Blocks\BlockTemplatesController templates_directory] => (string) "C:\apache\htdocs\wordpress\wp-content\plugins\woocommerce\packages\woocommerce-blocks/templates\templates"
                [ Automattic\WooCommerce\Blocks\BlockTemplatesController template_parts_directory] => (string) "C:\apache\htdocs\wordpress\wp-content\plugins\woocommerce\packages\woocommerce-blocks/templates\parts"

            [1] => (string) "render_woocommerce_template_part"

I also noted that, in the Fizzie theme I had removed the test that applied the override when Gutenberg was active.

if ( 'gutenberg_' . $render_callback == $args['render_callback'] ) {
bobbingwide commented 11 months ago

Looking at the functions hooked into register_block_type_args

0 60817408/60817408 512M F=565 register_block_type_args 
: 0   bw_trace_attached_hooks;9
: 9   wizzie_register_block_type_args;1 fizzie_register_block_type_args;1
: 10   gutenberg_register_metadata_attribute;1

I realized that the change to Fizzie meant that Wizzie's override is now being overridden by Fizzie So Fizzie should be changed to cater for it being the parent theme?

bobbingwide commented 11 months ago

So Fizzie should be changed to cater for it being the parent theme?

A pragmatic approach is for Fizzie to register its hook with priority 8 which Wizzie then overrides. Or for Wizzie to register its hook with priority 10?

C:\apache\htdocs\wordpress\wp-content\plugins\oik-bwtrace\includes\bwtrace-actions.php(581:0)
bw_trace_attached_hooks(1) 26 0 2023-11-03T18:00:48+00:00 1.944401 0.352433 
cf=init,register_block_type_args 5664 23 0 85983232/85983232 512M F=1191 register_block_type_args 
: 0   bw_trace_attached_hooks;9
: 9   fizzie_register_block_type_args;1
: 10   gutenberg_register_metadata_attribute;1 wizzie_register_block_type_args;1
bobbingwide commented 11 months ago

Delivered in v1.1.0

Note: I've ignored the fact that both Fizzie and Wizzie are overriding WooCommerce's override to render template parts. So far this hasn't caused a problem. If it does in the future then I'll have to raise an other issue.