language.post_update.php 748 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. /**
  3. * @file
  4. * Post update functions for Language module.
  5. */
  6. use Drupal\Core\Entity\Entity\EntityFormDisplay;
  7. /**
  8. * Add the 'include_locked' settings to the 'language_select' widget.
  9. */
  10. function language_post_update_language_select_widget() {
  11. foreach (EntityFormDisplay::loadMultiple() as $display_form) {
  12. $content = $display_form->get('content');
  13. $changed = FALSE;
  14. foreach (array_keys($content) as $element) {
  15. if (isset($content[$element]['type']) && $content[$element]['type'] == 'language_select') {
  16. $content[$element]['settings']['include_locked'] = TRUE;
  17. $changed = TRUE;
  18. }
  19. }
  20. if ($changed) {
  21. $display_form->set('content', $content);
  22. $display_form->save();
  23. }
  24. }
  25. }