https://twill.io logo
Any tips on creating blocks during an import proce...
# ❓questions
k
Any tips on creating blocks during an import process? I'm going to be migrating some content from another system so working on a Command that creates some Module records and want to add a string to a simple custom block. I'm trying to mimic the payload posted from the admin. Works for form inputs and translatable fields but can't seem to find where blocks are specifically created/updated in the source. Working with this so far
Copy code
// mimic format of admin PUT request
$ta['name'] = $data[0];
$ta['active'] = 1; // seems required for translations
$ta['summary'] = $data[5]; // translatable input

// Block content doesn't get created
$ta['blocks'][] = [
    'id' => now(),
    'content' => $data[7],
    'type' => "a17-block-app-text",
    'is_repeater' => false,
    'editor_name' => 'default'
];

$twillArtist = TwillArtist::create($ta);
$twillArtist->setSlugs();
$twillArtist->save();