Confused about Log1x/acf-composer

Hello everybody,
Im a bit confused about Log1x/acf-composer

  • Can we created fields directly from ACF UI ? in other words can i use it to generate blocks only without creating fields ?
  • Can you please share your experienced workflow ?
  • Can i used in a production website ?
  • Is there any recommended way to create ACF blocks ?

Thanks in advance

Hi @Tartamata,

Yes, it’s opt-in. The ACF GUI is unaffected. Your blocks can use ACF fields, or not. It’s up to you.

There are many approaches. We create ACF blocks with Sage / Blade / acf-composer (sage/resources/views/blocks/your-block.blade.php), then create Gutenberg parts (sage/parts/your-part.html), assembling those blocks together for areas like the header or footer. This gives flexibility to the user, but also sets up a zero-config layout.

Yes!

As you already are, use something like log1x/acf-composer, allowing Blade templates in ACF blocks, amongst other benefits.

Thank you @talss89
Im still confused:

  • How to call ACF fields in html template ?
  • Is there any example i can see ?

The HTML templates in parts/ should follow block grammar. You only compose blocks in HTML, so you wouldn’t access ACF or post meta directly from within a Gutenberg / Block Editor HTML template.

You would, however, call ACF fields from within a block, using PHP. Typically with ACF’s get_field(). The log1x/acf-composer docs have more info.

If you haven’t seen this, check out Full site editing for theme developers - Full Site Editing There are lots of resources and examples there.

An example of using block grammar to load a ACF block as part of a HTML part could be:

<!-- wp:acf/your-block {"name":"acf/your-block"} -->
<p>Inner content</p>
<!-- /wp:acf/your-block -->

Thank you @talss89
Sorry for my ignonrance :frowning:
The doc here is a bit confusing: GitHub - Log1x/acf-composer: Compose ACF Fields, Blocks, Widgets, and Option Pages with ACF Builder on Sage 10.

I will create fields exclusively using ACF GUI, so is acf-builder required ?

I can now:

  • Create fields group (Block) in ACF GUI.
  • Generate block using acf-composer

But how can i add fields to controller ?

In other words let’s say i created (using ACF GUI):

  • Fields Group (Banner)
  • Fields (Heading, paragraph)

How can i:

  • Add these fields to controller
  • Call these fields in block view

Sorry for my ignonrance guys
Any news ?

I will create fields exclusively using ACF GUI, so is acf-builder required ?
That’s up to you

Add these fields to controller
Call these fields in block vieb
You can always use get_field(‘example’), or get_field(‘example’, get_the_id()).