Skip to content

Need to transfer field values from a matrix into a supertable #13430

Closed Answered by brandonkelly
gbowne-quickbase asked this question in Q&A
Discussion options

You must be logged in to vote

This can be accomplished using the resave/matrix-blocks command:

php craft resave/matrix-blocks \
  --field mainComponents \
  --type "hero" \
  --set sectionConfig \
  --to "fn(\$block) => ['new1' => ['type' => 1, 'fields' => ['backgroundColor' => \$block->backgroundColor, 'externalSpacing' => \$block->externalSpacing]]]"

Update 'type' => 1 with the actual Super Table block type ID. You can find it via a hidden input at the beginning of an input’s table row, within an entry edit page:

<input type="hidden" name="fields[mainComponents][blocks][2149][fields][sectionConfig][blocks][2162][type]" value="1">

Repeat the command for each Matrix block type, replacing hero with the Matrix block typ…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by brandonkelly
Comment options

You must be logged in to vote
1 reply
@brandonkelly
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants