function 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 333

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);
    }
    $deprecations_triggered =& $this->triggeredDeprecations['table_css_class'][$view->id()];
    if ($this->deprecationsEnabled && $changed && !$deprecations_triggered) {
        $deprecations_triggered = TRUE;
        @trigger_error(sprintf('The update to add a default table CSS class for view "%s" is deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. Profile, module and theme provided configuration should be updated. See https://www.drupal.org/node/3499943', $view->id()), E_USER_DEPRECATED);
    }
    return $changed;
}

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