7 – Center concatenated fields in theme table


In the attached image I have two similar tables. The first one was created using views, the second one is the table I’m creating with my own module.

My question is: How can I center the information in the middle (the teams and logos). I want the “-” to be vertically aligned. Also, why does the header is never aligned with the rows? Below is my code where I try to use class to make the alignment but without success.

My site theme is Boostrap.

Thanks!

enter image description here

function getNextGamesTable($league_id) {
    $header = array(
        array('data' => 'Date', 'align' => 'center'),
        array('data' => 'status', 'align' => 'center'),
        array('data' => 'Score', 'align' => 'center'),
        array('data' => 'Odd', 'align' => 'center'),
        array('data' => 'Bet', 'align' => 'center'),
        array('data' => 'Possible returns', 'align' => 'center'),
    );
    
    $statusInput = 'Match Finished';
    $tid_status = key(taxonomy_get_term_by_name($statusInput, 'status'));
    
    $rows = array();
    
    $query = new EntityFieldQuery();
    $query->entityCondition('entity_type', 'node')
        ->entityCondition('bundle', array('fixture'))
        ->fieldCondition('field_league_id', 'value', $league_id , '=')
        ->fieldCondition('field_status', 'tid', $tid_status, '<>')
        ->propertyCondition('status', 1)
        ->fieldOrderBy('field_event_timestamp', 'value', 'ASC');
    $result = $query->execute();

    if (!empty($result('node'))) {
        $nids = array_keys($result('node'));

        $nodes = node_load_multiple(array_keys($result('node')));
        
        foreach ($nodes as $node) {
            $date = date("d-m-Y H:i", $node->field_event_timestamp('und')(0)('value'));
            $status = getNameFromTid($node->field_status('und')(0)('tid'));
            $hometeam = getNameFromTid($node->field_hometeam_name('und')(0)('tid'));
            $hometeamLogo = '<img class="custom-image-style" width="25" height="25" src="https://drupal.stackexchange.com/" . getNameFromTid($node->field_hometeam_logo('und')(0)('tid')) . "http://drupal.stackexchange.com/">';
            $awayteam = getNameFromTid($node->field_awayteam_name('und')(0)('tid'));
            $awayteamLogo = '<img class="custom-image-style" width="25" height="25" src="https://drupal.stackexchange.com/" . getNameFromTid($node->field_awayteam_logo('und')(0)('tid')) . "http://drupal.stackexchange.com/">';
            if (isset($node->field_score_fulltime('und')(0)('value'))) {
                $score_fulltime = $node->field_score_fulltime('und')(0)('value');
            } else {
                $score_fulltime = "http://drupal.stackexchange.com/";
            }
            if (isset($node->field_score_halftime('und')(0)('value'))) {
                $score_halftime = $node->field_score_halftime('und')(0)('value');
            } else {
                $score_halftime = "http://drupal.stackexchange.com/";
            }
            if (!empty($score_halftime)) {
                $score = $hometeam . $hometeamLogo . $score_fulltime . ' (' . $score_halftime . ')' . $awayteamLogo . $awayteam;
            } else {
                $score = $hometeam . $hometeamLogo . ' - ' . $awayteamLogo . $awayteam;
            }
            $odd = number_format($node->field_odd('und')(0)('value'), 2);
            $bet = number_format($node->field_bet_value('und')(0)('value'), 2);
            $possible_returns = number_format($node->field_possible_returns('und')(0)('value'), 2);

            $rows() = array(
                array('data' => $date, 'align' => 'center'),
                array('data' => $status, 'align' => 'center'),
                array('data' => $score, 'align' => 'center'),
                array('data' => $odd, 'align' => 'center'),
                array('data' => $bet, 'align' => 'center'),
                array('data' => $possible_returns, 'align' => 'center'),
            );
        }
    }
    
    $table_attributes = array('id' => 'nextgames-table', 'align' => 'center');
    
    $form('table') = array(
        '#markup' => theme('table', array('header' => $header, 'rows' => $rows)),
    );
    
    $tableInfo = array(
        'header' => $header,
        'rows' => $rows,
    );
    
    return $tableInfo;
}