i am trying to create a super table field programmatically. this is the code i tried.
i see super table field in field list but i can see fields inside of super table.
how can i do this?
//create super table field itself
$superTable = new SuperTableField([
'name' => 'supertablefield',
'handle' => 'supertablefield',
'groupId' => 1
]);
Craft::$app->getFields()->saveField($superTable);
//field inside super table
$field = new \craft\fields\PlainText([
"name" => 'textfield',
"handle" => 'textfield',
"translationMethod" => "site",
"multiline" => 0,
]);
//create and set block type
$blockModel = new SuperTableBlockTypeModel();
$blockModel->fieldId = $superTable->id;
$blockModel->uid = StringHelper::UUID();
$blockModel->setFields([$field]);
$superTable->setBlockTypes([$blockModel]);
SuperTable::$plugin->service->saveBlockType($blockModel);