data__accession_formatter.inc 670 B

123456789101112131415161718192021222324252627
  1. <?php
  2. class data__accession_formatter extends ChadoFieldFormatter {
  3. // The default lable for this field.
  4. public static $default_label = 'Site Accession';
  5. // The list of field types for which this formatter is appropriate.
  6. public static $field_types = ['data__accession'];
  7. /**
  8. * @see TripalFieldFormatter::view()
  9. */
  10. public function view(&$element, $entity_type, $entity, $langcode, $items, $display) {
  11. $content = '';
  12. if ($items[0]['value']) {
  13. $content = $items[0]['value'];
  14. }
  15. $element[0] = [
  16. // We create a render array to produce the desired markup,
  17. '#type' => 'markup',
  18. '#markup' => $content,
  19. ];
  20. }
  21. }