moderntribe / square-one

Modern Tribe's legacy WordPress framework for the classic editor.
GNU General Public License v2.0
89 stars 20 forks source link

blocks.registerBlockType addFilter doesn't work within init hook #1026

Closed whoami-pwd closed 2 years ago

whoami-pwd commented 2 years ago

Issue:

It was noticed that the registerBlockType filter doesn't run if it is inside ready( init ); call.

The following example will not work as expected if we put the filter within init at wp-content/themes/core/assets/js/src/admin/editor/hooks.js (here):

addFilter( 'blocks.registerBlockType', 'tribe/filter-alignment', setAlignmentSupports );

Potential Solution: We can create a separate file with all the registerBlockType filters required and hook it directly before the ready( init ) call

ChrisMKindred commented 2 years ago

@alexander-kozhukhovski Can you provide more details on this issue? A link to the call would be nice for troubleshooting and a potential solution if you have one.

whoami-pwd commented 2 years ago

@alexander-kozhukhovski Can you provide more details on this issue? A link to the call would be nice for troubleshooting and a potential solution if you have one.

Description and possible solution added.

whoami-pwd commented 2 years ago

Resolved with https://github.com/moderntribe/square-one/pull/1036