Pennebaker / craftcms-thearchitect

CraftCMS plugin to generate content models from JSON data.
MIT License
171 stars 9 forks source link

Neo export w/ SuperTable throws error #42

Closed Emkaytoo closed 7 years ago

Emkaytoo commented 7 years ago

I exported a Neo field that referenced a SuperTable field, and the SuperTable didn't have a value in the width column. I received the following error (line 2825 is highlighted in the error):

if ($includeID) {
2814                     $fieldId = $sTField->id;
2815                 } else {
2816                     $fieldId = 'new'.$sTFieldCount;
2817                 }
2818                 $columns = array_values($newField['typesettings']['columns']);
2819                 $newField['typesettings']['blockTypes'][$blockId]['fields'][$fieldId] = [
2820                     'name' => $sTField->name,
2821                     'handle' => $sTField->handle,
2822                     'instructions' => $sTField->instructions,
2823                     'required' => $sTField->required,
2824                     'type' => $sTField->type,
2825                     'width' => $columns[$sTFieldCount - 1]['width'],
2826                     'typesettings' => $sTField->settings,
2827                 ];
2828                 if ($sTField->type == 'PositionSelect') {
2829                     $options = [];
2830                     foreach ($sTField->settings['options'] as $value) {
2831                         $options[$value] = true;
2832                     }
2833                     $newField['typesettings']['blockTypes'][$blockId]['fields'][$fieldId]['typesettings']['options'] = $options;
2834                 }
2835                 if ($sTField->type == 'Matrix') {
2836                     $this->setMatrixField($newField['typesettings']['blockTypes'][$blockId]['fields'][$fieldId], $sTField->id);
2837                 }

After giving it a width value, I was able to export successfully. I suspect exporting just the width field would have resulted in the same error, but I didn't test it.