Add a link into a drupal header and table I am currently in the process of creating a free sports betting site, and I would be able to manage the matches. For this, I create a table with the data from my table, but I would add a column to manage the matches, to remove them or modify them. Outside, I do not like to add a link in the header, for exemple:

 l(t('Modify'), 'link/modi');


Here is my actual code:

    function get_rencontre_all(){

    $header = array(
    array('data' =&gt; 'journee', 'field' =&gt; 'journee' ),
    array('data' =&gt; 'eq1', 'field' =&gt; 'eq1'),
    array('data' =&gt; 'eq2', 'field' =&gt; 'eq2'),
    array('data' =&gt; 'stade', 'field' =&gt; 'stade'),
    array('data' =&gt; 'date', 'field' =&gt; 'date'),
    array('data'=&gt;'Opérations', 'colspan' =&gt; 1),
    );

    db_set_active('sport_db');
    $query = db_select('rencontre', 'r')-&gt;fields('r');

    $sorter = $query-&gt;extend('TableSort') //création de l'objet TableSort
    -&gt;orderByHeader($header); //détermination du trier
    $result = $sorter-&gt;execute(); //exécution du TableSort
    db_set_active();
    return $result-&gt;fetchAll(PDO::FETCH_ASSOC); //revoie d'un tableau de lignes



}

function modulesport_page_rencontre_manage(){
    $rows = get_rencontre_all();
    //header qui définit les colonnes et les champs associés
    $header = array(
    array('data' =&gt; 'Journée', 'field' =&gt; 'journee' ),
    array('data' =&gt; 'Equipe domicile', 'field' =&gt; 'eq1'),
    array('data' =&gt; 'Equipe exterieur', 'field' =&gt; 'eq2'),
    array('data' =&gt; 'Stade', 'field' =&gt; 'stade'),
    array('data' =&gt; 'Date', 'field' =&gt; 'date'),
    array('data'=&gt;'Opérations', 'colspan' =&gt; 1),


    );

    $page_array = array(
    'titre' =&gt; array(
    '#prefix' =&gt; '&lt;h1&gt;',
    '#suffix' =&gt; '&lt;/h1&gt;',
    '#markup' =&gt; 'Liste des rencontres',
    ),
    'tableau' =&gt; array(
    '#theme' =&gt; 'table',
    '#header' =&gt; $header,
    '#rows'=&gt; $rows,
    ),
    );
    return $page_array;

}
Instead of returning returning $result-&gt;fetchAll(PDO::FETCH_ASSOC), You need to loop the result and add a link to the array like :

$rows = array();

foreach ($result-&gt;fetchAll(PDO::FETCH_ASSOC) as $row) {
  $rows[] = $row + array('link' =&gt; l('MyLinkText', 'mylinkhere'));
}

return $rows;