2

I'm looking for a way to handle a grid field with the channel entry API.

Documentation has nothing, and could barely find anything else online about except for this: Inserting a new Grid row using the API, but there is no solution through the API.

Has anyone figured this one out yet?

3

I'm pretty sure you can just pass in the fieldname the row and column like

$data['field_id_X'][rows][new_row_1][col_id_1] = 'row 1';
$data['field_id_X'][rows][new_row_2][col_id_1] = 'row 2';

Just increment new_row_x as needed and match up your col_id_x numbers

| improve this answer | |
  • Thanks for this, your answer was pretty much spot on, jigged it around a bit and posted an answer to this myself. – Owen Kavanagh Aug 27 '14 at 19:52
1

Very close to @johnathan-waters answer I imported new grid rows using this code

$data['field_id_X']['rows']['new_row_Y']['col_id_Z'] = 'value';

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.