sage icon indicating copy to clipboard operation
sage copied to clipboard

Feature Request: Blade Support for Patterns

Open ouun opened this issue 3 years ago • 1 comments

Terms

Summary

With WordPress 6.0 it got very easy to register new Patterns by throwing them as PHP files into the /patterns folder: https://make.wordpress.org/core/2022/05/02/new-features-for-working-with-patterns-and-themes-in-wordpress-6-0/

That folder is located in the theme root, also with Sage 10. It would be great to have Blade support for the Pattern files and to move the folder to the other /views.

Motivation

Why are we doing this?

Patterns are very powerful and can be used for Block Templates.

What use cases does it support?

With Blade support it would be possible to build on the pattern system also with FSE outlook.

What is the expected outcome?

Blade support within Pattern files

Additional Context

No response

ouun avatar Jun 14 '22 21:06 ouun

https://github.com/WordPress/WordPress/blob/a5cc224b3c5a5d983673f5f8ec4b3a7ae9e97f27/wp-includes/block-patterns.php#L225 unfortunately wordpress doesn't provider a filter for the patterns directory

i think that the ideal scenario would be that patterns would be created at resources/views/patterns and compiled to somewhere that isn't patterns. but since we can't do that, we would then have to gitignore the theme patterns directory.

it seems like whatever way we were to do this right now would be a bit janky. it would be nice if core would support customizing the path for this (and other) editor files and directories (like theme.json).

retlehs avatar Jul 10 '22 17:07 retlehs

Closing for now. Poet by @Log1x supports registering patterns with Blade

retlehs avatar Aug 21 '22 18:08 retlehs