All pastes #604994 Raw Edit

Stuff

public text v1 · immutable
·published 2007-07-05 21:51 UTC
rendered paste body
<?php
$form['element'] = array(
  '#type' => 'table',
  '#title' => 'My Table',
  '#columns' => array(
    'My first header' => array(
      array(
        'coolstuff',
        array(
          '#type' => 'cell',
          '#data' => 'this is some data',
          '#attributes' => array('class' => 'testing')
        ),
      ),
    ),
    'My Second Header' => array(
      '#type' => 'column',
      '#data' => array(
        'foo',
        'bar',
      )
    )
  ),
);

OR

$form['element'] = array(
  '#type' => 'table',
  '#title' => 'My Table',
  '#headers' => array(
    'My first header', // This will get t-ified later
    'My second header!',
  ),
  '#rows' => array(
    array(
      array(
        'coolstuff',
        array(
          '#type' => 'cell',
          '#data' => 'this is some data',
          '#attributes' => array('class' => 'testing')
        ),
      ),
    ),
    array(
      '#type' => 'row',
      '#data' => array(
        'foo',
        'bar',
      )
    )
  ),
);