I'm attempting to add a link to flag each term output by hierarchical select in a views template.
Here's the relevant code from hs_taxonomy.module:
function theme_hs_taxonomy_formatter_lineage($variables) { $output = ''; $lineage = $variables['lineage']; $separator = theme('hierarchical_select_item_separator'); dpm($variables); // Render each item within a lineage. $items = array(); foreach ($lineage as $level => $item ) { dpm($lineage); $line = '<span class="lineage-item lineage-item-level-' . $level . '">'; $line .= drupal_render($item); $line .= '</span>'; dpm($item); $items[] = $line; } $output .= implode($separator, $items); return $output; } And here's the output of dpm($item): 
Based on the flag module documentation, I tried to add the link like this: $line .= flag_create_link('hobbies', $term->$item['#options']['entity']['tid']);
But that gives this error: Fatal error: Cannot use object of type stdClass as array in /mysite/sites/all/modules/contrib/hierarchical_select/modules/hs_taxonomy.module on line 880
How can I get the tid of the term being output?