I'm both glad and a little frustrated to have found this module. Glad because it really ought to exist. Frustrated because I just finished coding my own 'table' element type. However, there's an important feature missing.

In table_element.module on line 274, $row['data'][] = array('data' => &$element[$first][$second]);. However, there is other information that one might want in that array, such as an ID or a colspan for the <td> element. I'd like to request that the cell be able to have an #attributes tag that applies to the <td>. However, since those cells will almost always use their own #attributes tags, it will have to be something else, like #cell.

Simple example:

  $items['table_element'] = [
    '#type' => 'table',
    '#header' => [t('Title'), t('Data')],
    '#sticky' => FALSE,
  ];

  $items['table_element'][] = [
    'title' => [
      '#markup' => 'Title cell',
      '#cell' => [
        'class' => 'td-element-class',
        'data-title' => t('TD element title'),
      ],
    ],
    'data' => [
      '#markup' => 'Data cell',
    ],
  ];

Comments

meustrus’s picture

Issue summary: View changes
br0ken’s picture

Status: Active » Needs review
StatusFileSize
new730 bytes
br0ken’s picture

Issue summary: View changes
StatusFileSize
new1.19 KB
new528 bytes
br0ken’s picture

Issue summary: View changes
m1r1k’s picture

Status: Needs review » Reviewed & tested by the community
br0ken’s picture

Assigned: Unassigned » br0ken
Status: Reviewed & tested by the community » Fixed

Changes already in 7.x-1.0-beta2

br0ken’s picture

Status: Fixed » Closed (fixed)