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

Undefined variable $formBuilder #2544

Closed rico closed 3 months ago

rico commented 5 months ago

Description

After updating form v2 to v3 I get the following error for some of my CMS pages (which are not modules) that extend the twill::layouts.form view.

Undefined variable $formBuilder (View: [...]/vendor/area17/twill/views/layouts/form.blade.php) (View: [...]/vendor/area17/twill/views/layouts/form.blade.php)

For example:

Entry in twill-navigation.php:

'kontakt' => [
    'title' => 'Kontakt',
    'route' => 'twill.kontakt',
],

The controller code:

class PageController extends ModuleController
{
    protected $moduleName = 'pages';

    public function kontakt(PageRepository $page)
    {
        return view('twill.pages.kontakt',
            $this->form(
                $page->byName('kontakt')->id
            )
        );
    }
}

The view:

@extends('twill::layouts.form', [
    'customTitle' => 'Kontakt',
    'editableTitle' => false,
    'contentFieldsetLabel' => 'Eigenschaften',
])

@section('contentFields')

    @formField('wysiwyg', [
        'name' => 'content.body',
        'label' => 'Inhalt',
        'required' => true,
        'toolbarOptions' => [
            ['header' => [2, 3, 4, 5, 6, false]],
            'bold',
            'italic',
            'underline',
            'strike',
            ['list' => 'ordered'],
            ['list' => 'bullet'],
            ['indent' => '-1'],
            ['indent' => '+1'],
            ["align" => []],
            'link',
            "clean",
        ],
    ])
@stop

Steps to reproduce

Open the admin and select the page.

Expected result

No error, $formBuilder should be defined.

Actual result

Error as stated above.

Versions

Twill: 3.2.0 Laravel: v9.52.16 PHP: 8.0.30