public function data__sequence_formatter::view

3.x data__sequence_formatter.inc public data__sequence_formatter::view(&$element, $entity_type, $entity, $langcode, $items, $display)

Overrides TripalFieldFormatter::view

See also

TripalFieldFormatter::view()

File

tripal_chado/includes/TripalFields/data__sequence/data__sequence_formatter.inc, line 13

Class

data__sequence_formatter

Code

public function view(&$element, $entity_type, $entity, $langcode, $items, $display) {

  $content = 'There is no sequence.';
  if (count($items) > 0 and $items[0]['value']) {
    $num_bases = 50;
    $content = '<pre class="residues-formatter">';
    $content .= wordwrap($items[0]['value'], $num_bases, "<br>", TRUE);
    $content .= '</pre>';
  }
  $element[0] = array(
    // We create a render array to produce the desired markup,
    '#type' => 'markup',
    '#markup' => $content,
  );
}