Skip to content

[6.x] Add default row values to Table fields - #19681

Merged
brandonkelly merged 8 commits into
6.xfrom
rias/cms-123-table-fields-default-row-values-setting
Sep 22, 2026
Merged

brandonkelly merged 8 commits into
6.xfrom
rias/cms-123-table-fields-default-row-values-setting

Conversation

@riasvdv

@riasvdv riasvdv commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Description

Adds a “Default Row Values” setting to Table fields, so newly added rows can start with configured values in both control panel rendering stacks.

Table field
├── Default Values       # initial rows for new elements
└── Default Row Values   # values applied whenever a row is added
    ├── Vue TableControl
    └── Twig editableTable

Related issues

@linear-code

linear-code Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

CMS-123

@github-actions

github-actions Bot commented Sep 21, 2026

Copy link
Copy Markdown

📚 Storybook previews

@craftcms/uiopen Storybook

No changed components detected in this Storybook.

resources/jsopen Storybook

No changed components detected in this Storybook.

@github-actions

Copy link
Copy Markdown

This PR had conflicts with 6.x. Claude attempted an automatic resolution and pushed a merge commit. Please review the merge commit carefully before approving/merging.

Claude's response

I resolved the merge conflict, committed the merge as 9c4a2d0 and pushed it to rias/cms-123-table-fields-default-row-values-setting. I haven't run the tests: Pest isn't installed in this checkout (vendor/bin/pest is missing), so I only checked that the file's PHP syntax is valid.

The conflict: tests/Unit/Field/TableTest.php was the only conflicted file. Both sides had added a new test in the same spot:

  • This branch: "uses configured default row values for newly added rows".
  • 6.x: "configures single-line defaults for new columns".

The two tests cover different things, and src/Field/Table.php had already merged cleanly with both changes in it. So I kept both tests one after the other and didn't need to leave any CONFLICT-REVIEW comments.

Worth a look: the two tests read the settings form differently. The 6.x test expects the columns table at nodes[0], and the branch test expects the default-row-values table at nodes[1]->children[1]. That fits how Table::settingsForm() is built now, but only a test run will confirm both still pass.

@github-actions

Copy link
Copy Markdown

This PR had conflicts with 6.x. Claude attempted an automatic resolution and pushed a merge commit. Please review the merge commit carefully before approving/merging.

Claude's response

I didn't push, because the branch already has this merge. While I was working, another run pushed 9c4a2d0. It merges the same 6.x commit (861c266) onto the same parent (ac619cc), and its file tree is identical to my local merge commit 668897651a. Force-pushing would only swap one identical commit for another, so I left the remote alone.

Conflict found: only tests/Unit/Field/TableTest.php had a conflict. The two branches each added a new test in the same spot:

  • this branch added uses configured default row values for newly added rows;
  • 6.x added configures single-line defaults for new columns.

Resolution: I kept both tests one after the other and restored the }); that closes the first one. The two tests don't overlap. The merged src/Field/Table.php supports both: the columns control still calls defaultValues(['type' => 'singleline']), and the default-row-values setting is still there. None of the choices were ambiguous, so I added no CONFLICT-REVIEW comments.

Verification: php -l shows no syntax errors, and there are no conflict markers left. I couldn't run the Pest tests because vendor/ isn't installed here, so a reviewer should let CI confirm that TableTest.php passes.

@brandonkelly
brandonkelly merged commit cc1e9c1 into 6.x Sep 22, 2026
23 checks passed
@brandonkelly
brandonkelly deleted the rias/cms-123-table-fields-default-row-values-setting branch September 22, 2026 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants