function range_update_8101 in Range 8
Implements hook_update_N().
Set 'range_combine' settings to FALSE for the existing range_unformatted field formatters.
See also
https://www.drupal.org/node/3142758
File
- ./
range.install, line 17 - Install, update and uninstall functions for the range module.
Code
function range_update_8101(array &$sandbox) {
/** @var \Drupal\Core\Entity\Display\EntityViewDisplayInterface $view_display */
foreach (EntityViewDisplay::loadMultiple() as $view_display) {
$should_be_updated = FALSE;
foreach ($view_display
->getComponents() as $name => $component) {
if (!empty($component['type']) && $component['type'] === 'range_unformatted') {
$component['settings']['range_combine'] = FALSE;
$view_display
->setComponent($name, $component);
$should_be_updated = TRUE;
}
}
if ($should_be_updated) {
$view_display
->save();
}
}
}