tripal_blast.module 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * @file
  4. * .module file of Tripal BLAST.
  5. */
  6. use Drupal\Core\Url;
  7. /**
  8. * Implements hook_theme().
  9. * Used by Tripal BLAST UI page.
  10. *
  11. * @see templates in /templates
  12. */
  13. function tripal_blast_theme($existing, $type, $theme, $path) {
  14. // Links rendered as a markup for the template file.
  15. $context_links = [
  16. // QUERY SEARCH TYPE:
  17. // blast/nucleotide, blast/protein.
  18. 'link_nucleotide' => \Drupal::l(t('Nucleotide'), Url::fromRoute('tripal_blast.nucleotide')),
  19. 'link_protein' => \Drupal::l(t('Protein'), Url::fromRoute('tripal_blast.protein')),
  20. // NUCLEOTIDE PROGRAM:
  21. // blast/nucleotide/nucleotide, blast/nucleotide/protein.
  22. 'link_blastn' => \Drupal::l(t('blastn'), Url::fromRoute('tripal_blast.nucleotide_nucleotide')),
  23. 'link_blastx' => \Drupal::l(t('blastx'), Url::fromRoute('tripal_blast.nucleotide_protein')),
  24. // PROTEIN PROGRAM:
  25. // blast/protein/nucleotide, blast/protein/protein.
  26. 'link_tblastn' => \Drupal::l(t('tblastn'), Url::fromRoute('tripal_blast.protein_nucleotide')),
  27. 'link_blastp' => \Drupal::l(t('blastp'), Url::fromRoute('tripal_blast.protein_protein')),
  28. ];
  29. // Pass rendered links as variables and make available in the template file.
  30. $variables = [
  31. // TripalBLAST UI page.
  32. 'theme-tripal-blast-ui' => [
  33. 'variables' => ['context_links' => $context_links],
  34. 'template' => 'template-tripal-blast-ui',
  35. ],
  36. ];
  37. return $variables;
  38. }