Change record status: 
Project: 
Introduced in branch: 
8.x
Description: 

Tables now take an optional #footer variable in the render array. This will render the rows in the footer using the <tfoot> tag.

Drupal 7

    $build['table'] = array(
      '#theme' => 'table',
      '#header' => array(
        'Header 1',
        'Header 2',
        'Header 3',
      ),
      '#rows' => array(
        array(
          'class' => array('row-class'),
          'data' => array(
            'Row Cell 1',
            array(
              'data' => 'Row Cell 2',
              'colspan' => 2,
            ),
          ),
        ),
        array(
          'class' => array('footer-class'),
          'data' => array(
            'Footer Cell 1',
            array(
              'data' => 'Footer Cell 2',
              'colspan' => 2,
            ),
          ),
        ),
      ),
    );
    print drupal_render($build);

Drupal 8

    $build['table'] = array(
      '#theme' => 'table',
      '#header' => array(
        'Header 1',
        'Header 2',
        'Header 3',
      ),
      '#rows' => array(
        array(
          'class' => array('row-class'),
          'data' => array(
            'Row Cell 1',
            array(
              'data' => 'Row Cell 2',
              'colspan' => 2,
            ),
          ),
        ),
      ),
      '#footer' => array(
        array(
          'class' => array('footer-class'),
          'data' => array(
            'Footer Cell 1',
            array(
              'data' => 'Footer Cell 2',
              'colspan' => 2,
            ),
          ),
        ),
      ),
    );
    print drupal_render($build);
Impacts: 
Site builders, administrators, editors
Module developers
Themers