Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Drupal 8: Insert default values for in newly added paragraphs fields
insert into paragraph__FIELD_NEWFIELD (bundle, deleted, entity_id, revision_id, langcode, delta, FIELD_NEWFIELD_value)
select type, 0, id, revision_id, langcode, 0, DEFAULT_FIELD_VALUE from paragraphs_item where type = 'PARENT_PARAGRAPH_TYPE';
insert into paragraph_revision__FIELD_NEWFIELD (bundle, deleted, entity_id, revision_id, langcode, delta, FIELD_NEWFIELD_value)
select type, 0, id, revision_id, langcode, 0, DEFAULT_FIELD_VALUE from paragraphs_item where type = 'PARENT_PARAGRAPH_TYPE'
@hudri
Copy link
Author

hudri commented May 29, 2018

do this ONCE IMMEDTIALY after creating adding the new field to the paragraph. no security checks at all. not tested with multi cardinality, multi language or multi revisions.

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment