Module: tools Branch: master Commit: efd5ba36a7c45869f1896609add08702a6621a73 URL: https://gitlab.winehq.org/winehq/tools/-/commit/efd5ba36a7c45869f1896609add0...
Author: Francois Gouget fgouget@codeweavers.com Date: Tue Aug 1 12:24:29 2023 +0200
testbot/cgi: Don't bypass CollectionBlock::GetSortedItems().
In addition to customizing the sort order CollectionBlock::GetSortedItems() also allows subclasses to filter the rows.
---
testbot/lib/ObjectModel/CGI/CollectionBlock.pm | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/testbot/lib/ObjectModel/CGI/CollectionBlock.pm b/testbot/lib/ObjectModel/CGI/CollectionBlock.pm index 00295e56..7e7e85ff 100644 --- a/testbot/lib/ObjectModel/CGI/CollectionBlock.pm +++ b/testbot/lib/ObjectModel/CGI/CollectionBlock.pm @@ -210,6 +210,20 @@ sub DisplayProperty($$) return $PropertyDescriptor->GetClass eq "Detailref" ? "" : "ro"; }
+=pod +=over 12 + +=item C<GetSortedItems()> + +Returns a reference to the list of items to show in the collection block. + +By default it just forwards the call to the collection's GetSortedItems() +method but it can be redefined to customize the sort order or select which +items to show. + +=back +=cut + sub GetSortedItems($$) { my ($self, $Items) = @_; @@ -480,7 +494,7 @@ sub GenerateList($) $HasDT ||= ($PropertyDescriptor->GetClass() eq "Basic" and $PropertyDescriptor->GetType() eq "DT"); } - my $Items = $self->{Collection}->GetSortedItems(); + my $Items = $self->GetSortedItems(); if ($HasDT and @$Items != 0) { $self->{EnclosingPage}->GenerateImportJS(GetDateTimeJSFile());