views_handler_field_residues.inc 765 B

123456789101112131415161718192021222324252627282930313233343536373839
  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'] = array('table' => 'feature', 'field' => 'residues');
  19. }
  20. /**
  21. * {@inheritdoc}
  22. */
  23. function query() {
  24. $this->ensure_my_table();
  25. $this->add_additional_fields();
  26. }
  27. /**
  28. * {@inheritdoc}
  29. */
  30. function render($values) {
  31. // add a <br> every 100 bp
  32. return ereg_replace("(.{100})", "\\1<br />", $values->feature_residues);
  33. }
  34. }