public function operation__phylotree_vis_formatter::view
3.x operation__phylotree_vis_formatter.inc | public operation__phylotree_vis_formatter::view(&$element, $entity_type, $entity, $langcode, $items, $display) |
Overrides TripalFieldFormatter::view
See also
File
- tripal_chado/
includes/ TripalFields/ operation__phylotree_vis/ operation__phylotree_vis_formatter.inc, line 14
Class
Code
public function view(&$element, $entity_type, $entity, $langcode, $items, $display) {
global $user;
if (count($items) > 0) {
if (user_access('administrator')) {
$message = t('Site administrators: You can customize the look of phylogenetic trees at the !menu page.',
array('!menu' => l('Phylogeny and Taxonomy', 'admin/tripal/storage/chado/phylogeny')));
$admin_message = tripal_set_message($message, TRIPAL_INFO, array('return_html' => TRUE));
$element[0]['admin_message'] = array(
'#type' => 'markup',
'#markup' => $admin_message,
);
}
$phylotree = $entity->chado_record;
$node = new stdClass();
$node->phylotree = $phylotree;
$phylotree = chado_expand_var($phylotree, 'field', 'phylotree.comment');
module_load_include('inc', 'tripal_chado', 'includes/tripal_chado.phylotree');
tripal_phylogeny_prepare_tree_viewer($phylotree);
if ($phylotree->has_nodes) {
$element[0]['comment'] = array(
'#type' => 'markup',
'#markup' => 'Click a species to view its species page.',
);
$ajax_loader = url(drupal_get_path('module', 'tripal') . '/theme/images/ajax-loader.gif');
$element[0]['phylogram'] = array(
'#type' => 'markup',
'#markup' => '
<div id="phylogram">
<img src="' . $ajax_loader . '" class="phylogram-ajax-loader"/>
</div>
'
);
}
}
}