| 1 | package Bio::Graphics::Browser2::Plugin::TestFinder; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | use base 'Bio::Graphics::Browser2::Plugin'; | ||
| 6 | |||
| 7 | sub name { 'Features by type'} | ||
| 8 | |||
| 9 | sub type { 'finder' } | ||
| 10 | |||
| 11 | # return all objects of type given in the search field | ||
| 12 | sub find { | ||
| 13 | my $self = shift; | ||
| 14 | my $query = $self->page_settings->{name} or return; | ||
| 15 | return $self->auto_find($query); | ||
| 16 | } | ||
| 17 | |||
| 18 | sub auto_find { | ||
| 19 | my $self = shift; | ||
| 20 | my $query = shift; | ||
| 21 | my $search = $self->db_search; | ||
| 22 | my $features = $search->search_features({-type=>$query}); | ||
| 23 | return @$features ? $features : undef; | ||
| 24 | } | ||
| 25 | |||
| 26 | 1; |