data__accession_formatter.inc 807 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. class data__accession_formatter extends TripalFieldFormatter {
  3. // The default lable for this field.
  4. public static $default_label = 'Accession';
  5. // The list of field types for which this formatter is appropriate.
  6. public static $field_types = array('data__accession');
  7. // The list of default settings for this formatter.
  8. public static $default_settings = array();
  9. /**
  10. * @see TripalFieldFormatter::view()
  11. */
  12. public function view(&$element, $entity_type, $entity, $langcode, $items, $display) {
  13. foreach ($items as $delta => $item) {
  14. if ($item['value']) {
  15. $content = $item['value']['vocabulary'] . ':' . $item['value']['accession'];
  16. $element[$delta] = array(
  17. '#type' => 'markup',
  18. '#markup' => $content,
  19. );
  20. }
  21. }
  22. }
  23. }