diff options
Diffstat (limited to 'perllib/FixMyStreet/Cobrand/Base.pm')
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Base.pm | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Base.pm b/perllib/FixMyStreet/Cobrand/Base.pm index 5a9842233..ea2b8f410 100644 --- a/perllib/FixMyStreet/Cobrand/Base.pm +++ b/perllib/FixMyStreet/Cobrand/Base.pm @@ -38,6 +38,20 @@ sub moniker { return $last_part; } +=head2 asset_moniker + + $moniker = $cobrand_class->asset_moniker(); + +Same as moniker, except for the cobrand with the 'fixmystreet' moniker, when it +returns 'fixmystreet.com', as to avoid confusion that's where its assets are. + +=cut + +sub asset_moniker { + my $self = shift; + return $self->moniker eq 'fixmystreet' ? 'fixmystreet.com' : $self->moniker; +} + =head2 is_default $bool = $cobrand->is_default(); @@ -51,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! |