Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. olivero.theme

function olivero_preprocess_table

Implements hook_preprocess_table().

File

core/themes/olivero/olivero.theme, line 604

Code

function olivero_preprocess_table(&$variables) : void {
    // Mark the whole table and the first cells if rows are draggable.
    if (!empty($variables['rows'])) {
        $draggable_row_found = FALSE;
        foreach ($variables['rows'] as &$row) {
            
            /** @var \Drupal\Core\Template\Attribute $row['attributes'] */
            if (!empty($row['attributes']) && $row['attributes']->hasClass('draggable')) {
                if (!$draggable_row_found) {
                    $variables['attributes']['class'][] = 'draggable-table';
                    $draggable_row_found = TRUE;
                }
            }
        }
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal