class local__contact_formatter
Hierarchy
- class \TripalFieldFormatter
- class \ChadoFieldFormatter
- class \local__contact_formatter
- class \ChadoFieldFormatter
Expanded class hierarchy of local__contact_formatter
3 string references to 'local__contact_formatter'
- local__contact.inc in tripal_chado/
includes/ TripalFields/ local__contact/ local__contact.inc - tripal_chado_bundle_instances_info_custom in tripal_chado/
includes/ tripal_chado.fields.inc - Helper function for the hook_create_tripalfield_instance().
- tripal_chado_bundle_instances_info_linker in tripal_chado/
includes/ tripal_chado.fields.inc
File
- tripal_chado/
includes/ TripalFields/ local__contact/ local__contact_formatter.inc, line 3
View source
class local__contact_formatter extends ChadoFieldFormatter {
// The default lable for this field.
public static $default_label = 'Contact';
// The list of field types for which this formatter is appropriate.
public static $field_types = array('local_contact');
/**
*
* @see TripalFieldFormatter::settingsForm()
*/
public function settingsForm($view_mode, $form, &$form_state) {
}
/**
*
* @see TripalFieldFormatter::view()
*/
public function view(&$element, $entity_type, $entity, $langcode, $items, $display) {
// Get the settings
$settings = $display['settings'];
$type_term = chado_get_semweb_term('contact', 'type_id');
$name_term = chado_get_semweb_term('contact', 'name');
$description_term = chado_get_semweb_term('contact', 'description');
$headers = array('Name', 'Description', 'Type');
$rows = array();
foreach ($items as $delta => $item) {
$contact = $item['value'];
if (!$contact) {
continue;
}
// Get the field values
$contact_name = $contact[$name_term];
$description = $contact[$description_term];
$type = $contact[$type_term];
// Add a link i there is an entity.
if (array_key_exists('entity', $item['value']) and $item['value']['entity']) {
list($entity_type, $entity_id) = explode(':', $item['value']['entity']);
$contact_name = l($contact_name, "bio_data/" . $entity_id, array('attributes' => array('target' => "_blank")));
}
$rows[] = array($contact_name, $description, $type);
}
$table = array(
'header' => $headers,
'rows' => $rows,
'attributes' => array(
'id' => 'tripal_linker-table-contact-object',
'class' => 'tripal-data-table'
),
'sticky' => FALSE,
'caption' => "",
'colgroups' => array(),
'empty' => 'There are no contacts available.',
);
$content = theme_table($table);
if (count($items) > 0) {
// once we have our table array structure defined, we call Drupal's theme_table()
// function to generate the table.
$element[0] = array(
'#type' => 'markup',
'#markup' => $content,
);
}
}
}
Members
Name | Modifiers | Type | Description |
---|---|---|---|
local__contact_formatter:: |
public static | property |
The default lable for this field. Overrides TripalFieldFormatter:: |
local__contact_formatter:: |
public static | property |
The list of field types for which this formatter is appropriate. Overrides TripalFieldFormatter:: |
local__contact_formatter:: |
public | function |
Overrides TripalFieldFormatter:: |
local__contact_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 a summary of the formatter settings. |
TripalFieldFormatter:: |
public | function | Instantiates a new TripalFieldFormatter object. |