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 stock is the object, and the array with * the key 'subject' contains relationships where the stock is the subject */ $stock = $variables['node']->stock; $all_relationships = $stock->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 stock(s): record->object_id->name; if (property_exists($object->record, 'nid')) { $stock_name = l($stock_name, "node/" . $object->record->nid, ['attributes' => ['target' => "_blank"]]); } // link the organism to it's node $organism = $object->record->object_id->organism_id; $organism_name = $organism->genus . " " . $organism->species; if (property_exists($organism, 'nid')) { $organism_name = l("" . $organism->genus . " " . $organism->species . "", "node/" . $organism->nid, ['html' => TRUE]); } $rows[] = [ ['data' => $stock_name, 'width' => '30%'], [ 'data' => $object->record->object_id->uniquename, 'width' => '30%', ], ['data' => $organism_name, 'width' => '30%'], [ 'data' => $object->record->object_id->type_id->name, 'width' => '10%', ], ]; } // 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_stock-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 ?> stock(s) are this type_id->name; ?>: record->subject_id->name; if (property_exists($subject->record, 'nid')) { $stock_name = l($stock_name, "node/" . $subject->record->nid, ['attributes' => ['target' => "_blank"]]); } // link the organism to it's node $organism = $subject->record->subject_id->organism_id; $organism_name = $organism->genus . " " . $organism->species; if (property_exists($organism, 'nid')) { $organism_name = l("" . $organism->genus . " " . $organism->species . "", "node/" . $organism->nid, ['html' => TRUE]); } $rows[] = [ ['data' => $stock_name, 'width' => '30%'], [ 'data' => $subject->record->subject_id->uniquename, 'width' => '30%', ], ['data' => $organism_name, 'width' => '30%'], [ 'data' => $subject->record->subject_id->type_id->name, 'width' => '10%', ], ]; } // 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_stock-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); ?>