function ViewsConfigUpdater::processTableCssClassUpdate

Same name and namespace in other branches
  1. 11.x core/modules/views/src/ViewsConfigUpdater.php \Drupal\views\ViewsConfigUpdater::processTableCssClassUpdate()

Processes views and adds default CSS table class value if necessary.

Parameters

\Drupal\views\ViewEntityInterface $view: The view entity.

Return value

bool TRUE if the view was updated with a default table CSS class value.

2 calls to ViewsConfigUpdater::processTableCssClassUpdate()
ViewsConfigUpdater::needsTableCssClassUpdate in core/modules/views/src/ViewsConfigUpdater.php
Checks for table style views needing a default CSS table class value.
ViewsConfigUpdater::updateAll in core/modules/views/src/ViewsConfigUpdater.php
Performs all required updates.

File

core/modules/views/src/ViewsConfigUpdater.php, line 313

Class

ViewsConfigUpdater
Provides a BC layer for modules providing old configurations.

Namespace

Drupal\views

Code

public function processTableCssClassUpdate(ViewEntityInterface $view) : bool {
  $changed = FALSE;
  $displays = $view->get('display');
  foreach ($displays as &$display) {
    if (isset($display['display_options']['style']) && $display['display_options']['style']['type'] === 'table' && isset($display['display_options']['style']['options']) && !isset($display['display_options']['style']['options']['class'])) {
      $display['display_options']['style']['options']['class'] = '';
      $changed = TRUE;
    }
  }
  if ($changed) {
    $view->set('display', $displays);
  }
  return $changed;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.