Output from Matrix / Supertable #13
Answered
by
aaronbushnell
tigerchick
asked this question in
Q&A
-
Thank you for making this extremely useful plugin available. |
Beta Was this translation helpful? Give feedback.
Answered by
aaronbushnell
Mar 4, 2024
Replies: 1 comment
-
Thanks so much, @tigerchick, that means a lot! So, ultimately, XLSX and CSVs do a pretty poor job parsing multi-dimensional content. That's why you're better off getting it into some kind of comma-separated list. Here's an example of an endpoint that outputs an example set of categories or Matrix blocks into Reporter: 'transformer' => function (Entry $entry) {
return [
"id" => $entry->id,
"title" => $entry->title,
"url" => $entry->url,
"categories" => $entry->categories->collect()
->pluck('title') // Category One, Category Two, ...
->join(', '),
"socialNetworks" => $entry->matrixField->collect()
->map(fn ($block) => "$block->networkName ($block->url)") // Facebook (https://facebook.com/...), Twitter (https://twitter.com/...)
->join(', '),
];
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
aaronbushnell
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks so much, @tigerchick, that means a lot! So, ultimately, XLSX and CSVs do a pretty poor job parsing multi-dimensional content. That's why you're better off getting it into some kind of comma-separated list. Here's an example of an endpoint that outputs an example set of categories or Matrix blocks into Reporter: