Advertisement
Guest User

Untitled

a guest
Jan 19th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. langcode: en
  2. status: true
  3. dependencies:
  4. module:
  5. - paragraphs
  6. - text
  7. id: paragraph.field_accordion_section_title
  8. field_name: field_accordion_section_title
  9. entity_type: paragraph
  10. type: string_long
  11. settings: { }
  12. module: text
  13. locked: false
  14. cardinality: 1
  15. translatable: true
  16. indexes: { }
  17. persist_with_no_fields: false
  18. custom_storage: false
  19.  
  20. use DrupalfieldEntityFieldConfig;
  21. use DrupalfieldEntityFieldStorageConfig;
  22.  
  23. /**
  24. * Updates accordion section title to string type.
  25. */
  26. function my_module_update_8001() {
  27. if ($fields = Drupal::entityTypeManager()->getStorage('field_storage_config')->loadByProperties(array('field_name' => 'field_accordion_section_title'))) {
  28. foreach ($fields as $field) {
  29. $new_field = $field->toArray();
  30. $new_field['type'] = 'string_long';
  31. $new_field = FieldStorageConfig::create($new_field);
  32. $new_field->original = $field;
  33. $new_field->enforceIsNew(FALSE);
  34. $new_field->save();
  35. }
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement