$item) { $contact = $item['value']; if (!$contact) { continue; } // Get the field values $contact_name = $contact[$name_term]; $description = $contact[$description_term]; $type = $contact[$type_term]; // Add a link i there is an entity. if (array_key_exists('entity', $item['value']) and $item['value']['entity']) { list($entity_type, $entity_id) = explode(':', $item['value']['entity']); $contact_name = l($contact_name, "bio_data/" . $entity_id, array('attributes' => array('target' => "_blank"))); } $rows[] = array($contact_name, $description, $type); } $table = array( 'header' => $headers, 'rows' => $rows, 'attributes' => array( 'id' => 'tripal_linker-table-contact-object', 'class' => 'tripal-data-table' ), 'sticky' => FALSE, 'caption' => "", 'colgroups' => array(), 'empty' => 'There are no contacts available.', ); $content = theme_table($table); if (count($items) > 0) { // once we have our table array structure defined, we call Drupal's theme_table() // function to generate the table. $element[0] = array( '#type' => 'markup', '#markup' => $content, ); } } }