views_handler_field_residues.inc 779 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /**
  3. * @file
  4. * Contains views_handler_field_residues field handler
  5. */
  6. /**
  7. * A handler to provide proper displays for sequence residues.
  8. *
  9. * @ingroup tripal_legacy_feature
  10. * @ingroup views_field_handlers
  11. */
  12. class views_handler_field_residues extends views_handler_field {
  13. /**
  14. * {@inheritdoc}
  15. */
  16. function construct() {
  17. parent::construct();
  18. $this->additional_fields['residues'] = [
  19. 'table' => 'feature',
  20. 'field' => 'residues',
  21. ];
  22. }
  23. /**
  24. * {@inheritdoc}
  25. */
  26. function query() {
  27. $this->ensure_my_table();
  28. $this->add_additional_fields();
  29. }
  30. /**
  31. * {@inheritdoc}
  32. */
  33. function render($values) {
  34. // add a <br> every 100 bp
  35. return ereg_replace("(.{100})", "\\1<br />", $values->feature_residues);
  36. }
  37. }