You are here

function views_post_update_table_display_cache_max_age in Drupal 8

Fix cache max age for table displays.

File

core/modules/views/views.post_update.php, line 327
Post update functions for Views.

Code

function views_post_update_table_display_cache_max_age(&$sandbox = NULL) {
  \Drupal::classResolver(ConfigEntityUpdater::class)
    ->update($sandbox, 'view', function ($view) {

    /** @var \Drupal\views\ViewEntityInterface $view */
    $displays = $view
      ->get('display');
    foreach ($displays as $display_name => &$display) {
      if (isset($display['display_options']['style']['type']) && $display['display_options']['style']['type'] === 'table') {
        return TRUE;
      }
    }
    return FALSE;
  });
}