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?

2 Answers 2

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

1
  • Thanks for this, your answer was pretty much spot on, jigged it around a bit and posted an answer to this myself. Aug 27, 2014 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';

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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