stock; $synonyms = []; // expand the stock object to include the stockprop records $options = ['return_array' => 1]; $stock = chado_expand_var($stock, 'table', 'stockprop', $options); $stockprops = $stock->stockprop; // iterate through all of the properties and pull out only the synonyms if ($stockprops) { foreach ($stockprops as $stockprop) { if ($stockprop->type_id->name == 'synonym' or $stockprop->type_id->name == 'alias') { $synonyms[] = $stockprop; } } } if (count($synonyms) > 0) { ?>
The stock 'name ?>' has the following synonyms
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_stock-table-synonyms', '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); }