“Dynamic Block Patterns”: content editable, but “single source” for design?
-
It seems unfathomable to me that the following would not be possible, so I’m hoping that I’m just missing something or not using the right terminology when searching…
What I would ideally like to accomplish would include all three of the following:
- Create something like a block pattern by combining existing/core blocks — this is clearly possible by registering a “block template,” whether by including a file in the /patterns directory of a theme, or via PHP using
register_block_pattern
. (As an example, take the (extremely common!) design pattern of a “hero” or page header section that combines a Cover Block, Heading block, perhaps a subheading or description using the Heading or Paragraph block, and perhaps a Button block.) - Include the block pattern in the site editor by default when adding a new page/post/CPT, with the inner content editable by the user — this seems to be possible at least when using the PHP
register_block_pattern
method (by including ablockTypes
value as described here — it is however not clear to me whether or not there is an equivalent method when registering the pattern by adding a file to the /patterns folder instead of via PHP?) - The style of the pattern would be editable “globally” from a single/central location. (For example, the “hero section” pattern is in place on dozens of pages, and the site user or developer wishes to increase the vertical padding or minimum height of the Cover block contained in the pattern and have that change apply to all instances of the Pattern across the site.)
The searching I have done so far is leading me to believe that #1 and #3 are mutually exclusive, in that a Pattern’s style settings cannot be changed programmatically once the pattern has been saved into post/page content (i.e. into the database).
Is hand-coding a custom dynamic block really the only way to achieve #3 above?? And, if so, is there a way to “custom-code” a dynamic block that retains the ease of point #1 above — is there any way to do it that through copy-pasting markup to incorporate existing/core blocks, or can coding something like a simple repeating hero section only be done “from scratch” via block.json?
- Create something like a block pattern by combining existing/core blocks — this is clearly possible by registering a “block template,” whether by including a file in the /patterns directory of a theme, or via PHP using
- The topic ‘“Dynamic Block Patterns”: content editable, but “single source” for design?’ is closed to new replies.