class sio__annotation_formatter
Hierarchy
- class \TripalFieldFormatter
- class \ChadoFieldFormatter
- class \sio__annotation_formatter
- class \ChadoFieldFormatter
Expanded class hierarchy of sio__annotation_formatter
1 string reference to 'sio__annotation_formatter'
- tripal_chado_bundle_instances_info_linker in tripal_chado/
includes/ tripal_chado.fields.inc
File
- tripal_chado/
includes/ TripalFields/ sio__annotation/ sio__annotation_formatter.inc, line 3
View source
class sio__annotation_formatter extends ChadoFieldFormatter {
// The default lable for this field.
public static $default_label = 'Chado Annotation';
// The list of field types for which this formatter is appropriate.
public static $field_types = array('chado_linker__cvterm');
/**
*
* @see TripalFieldFormatter::view()
*/
public function view(&$element, $entity_type, $entity, $langcode, $items, $display) {
$headers = array('Term', 'Definition');
$rows = array();
$field_table = $this->instance['settings']['chado_table'];
$schema = chado_get_schema($field_table);
$vocabulary_term = chado_get_semweb_term('cvterm', 'cv_id');
$accession_term = chado_get_semweb_term('dbxref', 'accession');
$definition_term = chado_get_semweb_term('cvterm', 'definition');
if (array_key_exists('is_not', $schema['fields'])) {
$negation_term = chado_get_semweb_term($field_table, 'is_not');
}
$chado_table = $this->instance['settings']['chado_table'];
foreach ($items as $delta => $item) {
if (!empty($item['chado-' . $chado_table . '__cvterm_id'])) {
$cvterm = chado_generate_var('cvterm', array('cvterm_id' => $item['chado-' . $chado_table . '__cvterm_id']));
$dbxref = $cvterm->dbxref_id;
// Build the accession.
$accession = $dbxref->db_id->name . ':' . $dbxref->accession;
if ($dbxref->db_id->urlprefix) {
$accession = l($accession, chado_get_dbxref_url($dbxref), array('attributes' => array('target' => '_blank')));
}
$row = array(
$accession,
$item['value'][$definition_term],
);
if (array_key_exists('is_not', $schema['fields'])) {
if ($negation_term == FALSE) {
$row[1] = 'NOT ' . $row[1];
}
}
$rows[] = $row;
}
}
// Theme the results in a talbe.
$caption = 'This record is associated with the following annotations.';
$table = array(
'header' => $headers,
'rows' => $rows,
'attributes' => array(
'id' => "$chado_table-table-terms",
'class' => 'tripal-data-table'
),
'caption' => $caption,
'sticky' => FALSE,
'colgroups' => array(),
'empty' => 'There are no annotations of this type',
);
if (count($items) > 0) {
$element[0] = array(
'#type' => 'markup',
'#markup' => theme_table($table),
);
}
}
}
Members
Name | Modifiers | Type | Description |
---|---|---|---|
sio__annotation_formatter:: |
public static | property |
The default lable for this field. Overrides TripalFieldFormatter:: |
sio__annotation_formatter:: |
public static | property |
The list of field types for which this formatter is appropriate. Overrides TripalFieldFormatter:: |
sio__annotation_formatter:: |
public | function |
Overrides TripalFieldFormatter:: |
TripalFieldFormatter:: |
public static | property | The list of default settings for this formatter. |
TripalFieldFormatter:: |
protected | function | Updates a pager generated by theme('pager') for use with AJAX. |
TripalFieldFormatter:: |
protected | function | When constructing a pager for use by a field, all pagers must have a unique ID |
TripalFieldFormatter:: |
public static | function | Provides information about the formatter for this field. |
TripalFieldFormatter:: |
public | function | Provides the field's setting form. |
TripalFieldFormatter:: |
public | function | Provides a summary of the formatter settings. |
TripalFieldFormatter:: |
public | function | Instantiates a new TripalFieldFormatter object. |