12345678910111213141516171819202122232425262728 |
- <?php
- class so__cds_formatter extends ChadoFieldFormatter {
-
- public static $default_label = 'Coding Sequence';
-
- public static $field_types = ['so__cds'];
-
- 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] = [
-
- '#type' => 'markup',
- '#markup' => $content,
- ];
- }
- }
|