area17 / twill

Twill is an open source CMS toolkit for Laravel that helps developers rapidly create a custom admin console that is intuitive, powerful and flexible. Chat with us on Discord at https://discord.gg/cnWk7EFv8R.
https://twillcms.com
Apache License 2.0
3.71k stars 567 forks source link

Unable to use Fieldsets in Block #2530

Closed Tom-revere closed 3 months ago

Tom-revere commented 5 months ago

Description

I am trying to create Fieldsets within a block using Form Builder, however they never render in the CMS.

Steps to reproduce

Create a new block Replace the getForm function with the below

public function getForm(): Form
{        
    $form = Form::make();

    $form->add(Input::make()->name('title'));

    $form->withFieldSets(new Fieldsets([
        Fieldset::make()->title('Fieldset 1')->id('fieldset1')->fields([
            Input::make()
            ->name('fs1_content')
            ->label(twillTrans('FS 1 Content'))
        ]),
        Fieldset::make()->title('Fieldset 2')->id('fieldset2')->fields([
            Wysiwyg::make()
                ->name('fs2_content')
                ->label(twillTrans('FS 2 Content'))

        ])
    ]));

    $form->add(Input::make()->name('description'));

    return $form;
}

Expected result

It should show Fieldsets between Title and Description.

Actual result

It does not show any fieldsets, or the fields within these. Only Title and Description show.

Versions

Twill 3.2.0 Laravel 9.5.2 PHP 8.0.11 MySQL 5.7.33

ifox commented 3 months ago

Fieldsets are not currently supported in blocks and they haven't been designed to be supported there.

Moving this to a discussion, I'm curious to hear more about the use case for fieldsets in blocks.