uo__unit_formatter.inc 549 B

12345678910111213141516171819202122
  1. <?php
  2. class uo__unit_formatter extends ChadoFieldFormatter {
  3. // The default lable for this field.
  4. public static $default_label = 'Unit';
  5. // The list of field types for which this formatter is appropriate.
  6. public static $field_types = array('uo__unit');
  7. /**
  8. * @see TripalFieldFormatter::view()
  9. */
  10. public function view(&$element, $entity_type, $entity, $langcode, $items, $display) {
  11. if (count($items) > 0) {
  12. $element[0] = array(
  13. '#type' => 'markup',
  14. '#markup' => $items[0]['value'],
  15. );
  16. }
  17. }
  18. }