123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- Custom Link-outs
- =================
- In Tripal BLAST "Linkouts" refer to changing the hit name in the BLAST results table to a link. This link usually gives the user additional information and may link to pages in your Tripal site, external websites or genome browsers. You can configure link-outs per BLAST Database and depending on the type, many link-outs support regular expression for extracting parts of the name. The types provided by Tripal BLAST also require you select a Tripal Database (Tripal > Chado Modules > Databases) which contains the URL information for the link. If the link-out types supplied by Tripal BLAST do not fit your needs you can create a custom type using the documentation below.
- To create custom link-outs for Tripal BLAST you need to first create your own Drupal module. If you are unfamiliar with this process there are a number of good tutorial available in addition to the Drupal Documentation.
- Once you have a custom module you need to implement hook_blast_linkout_info() to tell Tripal BLAST about your custom link-out. You do this by creating a function with the name of your module replacing the word "hook". For example:
- .. code-block:: php
-
- function mymodule_blast_linkout_info() {
- $types = array();
- $types['mybrowser'] = array(
-
-
- 'name' => 'UofS Browser',
-
-
-
- 'process function' => 'mymodule_generate_linkout_mybrowser',
-
-
-
-
- 'help' => 'This type assumes your blast database is the reference for one
- of the University of Saskatchewan Genome Browsers and that you have selected
- the Tripal Database referencing that browser below.',
-
- 'require_regex' => TRUE,
- 'require_db' => TRUE,
- );
- return $types;
- }
- Next you need to implement the process function that you indicated. This function is given a number of variables providing information about the hit, etc. and is expected to generate a fully rendered link based on that information. For example,
- .. code-block:: php
-
- function tripal_blast_generate_linkout_link($url_prefix, $hit, $info, $options = array()) {
- if (isset($hit->{'linkout_id'})) {
-
-
-
-
-
- $hit_url = $url_prefix . $hit->{'linkout_id'};
-
-
- return l(
- $hit->{'linkout_id'},
- $hit_url,
- array('attributes' => array('target' => '_blank'))
- );
- }
- else {
- return FALSE;
- }
- }
|