public function TripalFieldFormatter::view
3.x TripalFieldFormatter.inc | public TripalFieldFormatter::view(&$element, $entity_type, $entity, $langcode, $items, $display) |
Provides the display for a field
This function corresponds to the hook_field_formatter_view() function of the Drupal Field API.
This function provides the display for a field when it is viewed on as a full page, teaser, indexing for searching, etc. The content returned by the formatter should only include what is present in the $items[$delta]['values] array. This way, the contents that are displayed on the page, via web services and downloaded into a CSV file will always be identical. The view need not show all of the data in the 'values' array.
Parameters
$element: A renderable array for the $items, as an array of child elements keyed by numeric indexes starting from 0. When implemented as a child class, this argument is set for the display.
$entity_type: The type of $entity.
$entity: The entity object.
$langcode: The language associated with $items.
$items: Array of values for this field.
$display: The display settings to use, as found in the 'display' entry of instance definitions. The array notably contains the following keys and values;
- type: The name of the formatter to use.
- settings: The array of formatter settings.
- chado_linker__contact_formatter::view in tripal_chado/
includes/ TripalFields/ chado_linker__contact/ chado_linker__contact_formatter.inc - chado_linker__prop_formatter::view in tripal_chado/
includes/ TripalFields/ chado_linker__prop/ chado_linker__prop_formatter.inc - data__accession_formatter::view in tripal_chado/
includes/ TripalFields/ data__accession/ data__accession_formatter.inc - data__protein_sequence_formatter::view in tripal_chado/
includes/ TripalFields/ data__protein_sequence/ data__protein_sequence_formatter.inc - data__sequence_checksum_formatter::view in tripal_chado/
includes/ TripalFields/ data__sequence_checksum/ data__sequence_checksum_formatter.inc
File
- tripal/
includes/ TripalFields/ TripalFieldFormatter.inc, line 128
Class
Code
public function view(&$element, $entity_type, $entity, $langcode, $items, $display) {
foreach ($items as $delta => $item) {
$element[$delta] = array(
'#type' => 'markup',
'#markup' => $item['value'],
);
}
}