public function so__cds_formatter::view

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

Overrides TripalFieldFormatter::view

See also

TripalFieldFormatter::view()

File

tripal_chado/includes/TripalFields/so__cds/so__cds_formatter.inc, line 13

Class

so__cds_formatter

Code

public function view(&$element, $entity_type, $entity, $langcode, $items, $display) {
  $content = 'There is no coding 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,
  );
}