add plugins filtering plugins and implement RemovePlugin PagePlugin
[scpubgit/App-SCS.git] / lib / App / SCS / Plugin / Core / PagePlugin / RemovePlugin.pm
diff --git a/lib/App/SCS/Plugin/Core/PagePlugin/RemovePlugin.pm b/lib/App/SCS/Plugin/Core/PagePlugin/RemovePlugin.pm
new file mode 100644 (file)
index 0000000..6348623
--- /dev/null
@@ -0,0 +1,21 @@
+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;