Log1x / acf-composer

Compose ACF Fields, Blocks, Widgets, and Option Pages with ACF Builder on Sage 10.
https://github.com/Log1x/acf-composer
MIT License
416 stars 57 forks source link

Passing params to a partial? #283

Open astray-heavy-arms opened 4 days ago

astray-heavy-arms commented 4 days ago

This is more a question than anything else.

If I generate a field partial that contains: -

text image relationship

Then say I use that partial in two diffrent blocks that need the relationship in one to reference post_type foo and the second block post type bar.

When using a partial how do I change the post types of the relationship field between my blocks?

Log1x commented 4 days ago

You should be able to use modifyField – I think this will work:

$field
    ->addPartial(Partials\Review::class)
    ->modifyField('advertiser_url', [
        'post_type' => ['bar'],
    ]);