all_relationships; * * This variable is an array with two sub arrays with the keys 'object' and 'subject'. The array with * key 'object' contains relationships where the pub is the object, and the array with * the key 'subject' contains relationships where the pub is the subject */ $pub = $variables['node']->pub; $all_relationships = $pub->all_relationships; $object_rels = $all_relationships['object']; $subject_rels = $all_relationships['subject']; if (count($object_rels) > 0 or count($subject_rels) > 0) { ?>
$rels) { foreach ($rels as $obj_type => $objects) { ?>This type_id->name; ?> is
the following pub(s): record->object_id->title;
if (property_exists($object->record, 'nid')) {
$title = l($title, "node/" . $object->record->nid, ['attributes' => ['target' => "_blank"]]);
}
// get the citation
$values = [
'pub_id' => $object->record->object_id->pub_id,
'type_id' => [
'name' => 'Citation',
],
];
$citation = chado_generate_var('pubprop', $values);
$citation = chado_expand_var($citation, 'field', 'pubprop.value');
$rows[] = [
$title . '
' . htmlspecialchars($citation->value),
];
}
// the $table array contains the headers and rows array as well as other
// options for controlling the display of the table. Additional
// documentation can be found here:
// https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
$table = [
'header' => $headers,
'rows' => $rows,
'attributes' => [
'id' => 'tripal_pub-table-relationship-object',
'class' => 'tripal-data-table',
],
'sticky' => FALSE,
'caption' => '',
'colgroups' => [],
'empty' => '',
];
// once we have our table array structure defined, we call Drupal's theme_table()
// function to generate the table.
print theme_table($table); ?>
The following
record->subject_id->type_id->name ?>
pub(s) are
this type_id->name; ?>: record->subject_id->title;
if (property_exists($subject->record, 'nid')) {
$title = l($title, "node/" . $subject->record->nid, ['attributes' => ['target' => "_blank"]]);
}
// get the citation
$values = [
'pub_id' => $subject->record->subject_id->pub_id,
'type_id' => [
'name' => 'Citation',
],
];
$citation = chado_generate_var('pubprop', $values);
$citation = chado_expand_var($citation, 'field', 'pubprop.value');
$rows[] = [
$title . '
' . htmlspecialchars($citation->value),
];
}
// the $table array contains the headers and rows array as well as other
// options for controlling the display of the table. Additional
// documentation can be found here:
// https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
$table = [
'header' => $headers,
'rows' => $rows,
'attributes' => [
'id' => 'tripal_pub-table-relationship-subject',
'class' => 'tripal-data-table',
],
'sticky' => FALSE,
'caption' => '',
'colgroups' => [],
'empty' => '',
];
// once we have our table array structure defined, we call Drupal's theme_table()
// function to generate the table.
print theme_table($table); ?>