Was having trouple loading a pattern in an ACF Block it was unable to get the block bindings before loading the block that was calling the pattern.
Using a shortcode to call the pattern seem to fix this and brings the pattern in with the block bindings working:
Shortcode function:
function gomo_get_plugin_part($atts) {
ob_start();
if ( $atts['file']) {
$filename = 'parts/' . $atts['file'] .'.php';
} else {
$filename = 'parts/testimonial-pattern.php';
}
require $filename;
return ob_get_clean();
}
add_shortcode('display-part', 'gomo_get_plugin_part');
Files are saved in the plugin and the pattern code can not be changed without copying the code in the theme editor making the changes and then putting back in the plugin file.
This could also be resolved by having a synced pattern on the site but this is hard to break for a user. Keeps the patterns library cleaner.
I imagine the block binding how to add them and work with them will get better soon but this is an option for now.
Example block binding pattern (built in the site editor and then saved out):
<!-- wp:paragraph { "metadata":{"bindings":{"content":{"source":"acf/field","args":{"key":"organisation"}}},"name":"Organisation"},"style":{"elements":{"link":{"color":{"text":"var:preset|color|secondary"}}}},"textColor":"secondary","fontSize":"small"} -->
<p class="has-secondary-color has-text-color has-link-color has-small-font-size">Organisation</p>
<!-- /wp:paragraph -->