aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/Cobrand/Base.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/Cobrand/Base.pm')
-rw-r--r--perllib/FixMyStreet/Cobrand/Base.pm12
1 files changed, 12 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Base.pm b/perllib/FixMyStreet/Cobrand/Base.pm
index a9eed0018..ea2b8f410 100644
--- a/perllib/FixMyStreet/Cobrand/Base.pm
+++ b/perllib/FixMyStreet/Cobrand/Base.pm
@@ -65,6 +65,18 @@ sub is_default {
return $self->moniker eq 'default';
}
+=head2 call_hook
+
+ $cobrand->call_hook(foo => 1, 2, 3); # calls $cobrand->foo(1, 2, 3) if it exists
+
+=cut
+
+sub call_hook {
+ my ($self, $method_name, @args) = @_;
+ my $method = $self->can($method_name) or return;
+ return $self->$method(@args);
+}
+
# NB: this Base class is for 'meta' features. To add base methods for all cobrands,
# you may want to look at FMS::Cobrand::Default instead!