URL generation for SubList
[scpubgit/SCS.git] / lib / SCSite / SubListFilter.pm
1 package SCSite::SubListFilter;
2
3 use Moo;
4
5 with 'SCSite::Filter';
6
7 sub _filter_stream {
8   my ($self, $stream, $config, $page) = @_;
9   my $max = $config->{max_entries}||undef; # explicit undef (not 0)
10   $stream->select('.SubList')
11          ->repeat_content($page->children->latest($max)->map(sub {
12              my $o = shift;
13              sub {
14                $_->select('.entry.title')->replace_content($o->title)
15                  ->select('.entry.description')->replace_content($o->description)
16                  ->select('.entry.created')->replace_content($o->created)
17                  ->select('.entry.link')->set_attribute(href => $o->path);
18              }
19           }));
20 }
21
22 1;