Closed simondotwhite closed 1 month ago
It should be simplified to $example->addPartial(YourPartial::class)
now.
Oh, I think you can just pass the partial straight to ->addLayout
now the same as my addPartial
example above: https://github.com/Log1x/acf-composer/blob/284c40b61e6efeea0995f1c0951c9606b7d021e1/src/Builder/FlexibleContentBuilder.php#L64-L75
Sorry, I never use Flexible Content anymore so I couldn't entirely remember. #252 should fix this.
Also, assuming all works well – we can probably get a rule for that in the upgrade command.
https://github.com/Log1x/acf-composer/blob/master/src/Console/UpgradeCommand.php#L49
Hey, thanks for coming back to me. When I try to pass the partial class in like this
->addLayout(Text::class)
It wasn't working. Although the following does, so maybe I've misunderstood.
class PageBuilder extends Partial
{
public function fields()
{
$pageBuilder = Builder::make('pageBuilder');
$pageBuilder
->addFlexibleContent('components', ['label' => 'Blocks'])
->addLayout('Text')->addPartial(Text::class)
->endFlexibleContent();
return $pageBuilder;
}
}
Thanks for your help!
Ah I see. It's good the latter works – but I think we can make it a bit better in the future. 👍
Hey,
Looking through some of the code and issues it seems like #175 is the most up to date information it. But in the code, it says that
$this->get()
is deprecated.Is there a better/more up-to-date way of adding partials as layouts when using Flexible Content?
Cheers