0

I am trying to programatiacally add two new neo blocks to an entry. It works, but it overwrites any manual added blocks that already exists in that entry.

For context:
I have an entry with three neo blocks, textModule, imageGallery and logoBlock. So I just want to update the entry with two more blocks, hero and a second textModule.

'projectBuilder' => [ // Neo field handle
        'blocks' => [
          'new0' => [
            'modified' => 1,
            'type' => 'hero', // Neo block handle
            'enabled' => 1,
            'collapsed' => 0,
            'level' => 0,
            'fields' => [
              'pageHeading' => "Heading", // Neo block field
            ]
          ],
          'new1' => [
            'modified' => 1,
            'type' => 'textModule', // Neo block handle
            'enabled' => 1,
            'collapsed' => 0,
            'level' => 1,
            'fields' => [
              'moduleHeading' => "Heading", // Neo block field
              'paragraph' => "Description", // Neo block field
            ],
          ],
        ],
        'sortOrder' => [
          'new0',
          'new1',
        ],

How do I add new blocks to an existing entry without deleting the existing blocks?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.