return $self->with(plugins => pond_write_datum(\@new));
}
-has _page_plugins => (is => 'lazy');
-
-sub _build__page_plugins {
+has _raw_page_plugins => (is => 'lazy', builder => sub {
my ($self) = @_;
my $plugin_config = $self->plugin_config;
my ($plugin_map, $defaults) = @{$self->_page_set->plugin_config}
my $info = $plugin_map->{$name};
push @plugins,
use_module($info->{class})->new(
- ($info->{config}||sub{})->(), %$config, page => $self
+ ($info->{config}||sub{})->(), %$config, page => $self,
+ plugin_map => $plugin_map, # some things will need this
);
}
return \@plugins;
-}
+});
+
+has _page_plugins => (is => 'lazy', builder => sub {
+ my ($self) = @_;
+ my $raw = $self->_raw_page_plugins;
+ reduce { $b->filter_plugins($a) } $raw, @$raw;
+});
sub published_at {
$_[0]->created
sub page_plugins {
my ($self) = @_;
PageList => 'App::SCS::Plugin::Core::PagePlugin::PageList',
+ RemovePlugin => 'App::SCS::Plugin::Core::PagePlugin::RemovePlugin',
Template => {
class => 'App::SCS::Plugin::Core::PagePlugin::Template',
config => sub { templates => $self->templates },
--- /dev/null
+package App::SCS::Plugin::Core::PagePlugin::RemovePlugin;
+
+use Moo;
+
+with 'App::SCS::Role::PagePlugin';
+
+has name => (is => 'ro', required => 1);
+
+has plugin_map => (is => 'ro', required => 1);
+
+has class => (is => 'lazy', builder => sub {
+ my ($self) = @_;
+ $self->plugin_map->{$self->name}{class}
+});
+
+sub filter_plugins {
+ my ($self, $plugins) = @_;
+ [ grep !$_->isa($self->class), @$plugins ];
+}
+
+1;