Skip to content

[6.x] Incorrect templating of tabbed forms #13478

@AtmoFX

Description

@AtmoFX

Bug description

In 6.x, it is possible to make any forms with tabs.
However, the form tag does only returns data from the main tab:

  • Only fields and sections arrays get defined by the tag
  • The above 2 arrays contain only the fields and sections, respectively, form the main tab.

Similar to #11836 (which I created for 5.x profile forms), 6.x should bring tags into {{ form }} + derive sections and fields with:

$data['sections'] = collect($data['tabs'])->flatMap->sections->all();
$data['fields'] = collect($data['sections'])->flatMap->fields->all();

How to reproduce

Create a form with 2 tabs each having 1 section and each section have 1 field (i.e. 2 fields in total) with the blueprint:

tabs:
  main:
    display: Main
    sections:
      -
        fields:
          -
            handle: input_main_tab
            field:
              type: text
              display: 'Input main tab'
  tab_2:
    display: 'Tab 2'
    sections:
      -
        display: 'New Section'
        fields:
          -
            handle: input_tab_2
            field:
              type: text
              display: 'Input tab 2'

The templating snippet available at https://statamic.dev/forms#the-template renders only 1 field.

Logs

Environment

Environment
Application Name: GaiaMine UAT
Laravel Version: 12.44.0
PHP Version: 8.3.6
Composer Version: 2.9.2
Environment: local
Debug Mode: ENABLED
URL: alpha.local/
Maintenance Mode: OFF
Timezone: UTC
Locale: en

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: file
Database: mysql
Logs: stack / single
Mail: smtp
Queue: sync
Session: database

Storage
public/storage: NOT LINKED

Livewire
Livewire: v4.0.0-beta.5

Statamic
Addons: 4
Sites: 1
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 6.0.0-alpha.16 PRO

Statamic Addons
alt-design/alt-seo: 1.3.0
jacksleight/statamic-bard-mutator: 3.0.5
pecotamic/sitemap: 1.4.10
statamic/eloquent-driver: 4.35.2

Statamic Eloquent Driver
Asset Containers: file
Assets: file
Blueprints: file
Collection Trees: file
Collections: file
Entries: eloquent
Fieldsets: file
Form Submissions: eloquent
Forms: file
Global Sets: file
Global Variables: file
Navigation Trees: file
Navigations: file
Revisions: file
Sites: file
Taxonomies: file
Terms: file
Tokens: file

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions