You are here

function office_hours_post_update_implement_office_hours_entity_view_display_schema in Office Hours 8

Adds Office Hours 'formatter.settings' schema changes in entity view display config in 8.x-1.3.

File

./office_hours.post_update.php, line 37
Post update functions for Office Hours.

Code

function office_hours_post_update_implement_office_hours_entity_view_display_schema(&$sandbox = NULL) {
  \Drupal::classResolver(ConfigEntityUpdater::class)
    ->update($sandbox, 'entity_view_display', function (EntityViewDisplayInterface $entityViewDisplay) {
    $updated = FALSE;
    foreach ($entityViewDisplay
      ->getComponents() as $key => $component) {
      if ($component['type'] === 'office_hours_table') {
        $component['settings']['compress'] = (bool) $component['settings']['compress'];
        $component['settings']['grouped'] = (bool) $component['settings']['grouped'];
        $component['settings']['schema']['enabled'] = (bool) $component['settings']['schema']['enabled'];
        $entityViewDisplay
          ->setComponent($key, $component);
        $updated = TRUE;
      }
    }
    return $updated;
  });
}