diff options
| author | Marius Halden <marius.h@lden.org> | 2017-05-28 21:31:42 +0200 |
|---|---|---|
| committer | Marius Halden <marius.h@lden.org> | 2017-05-28 21:31:42 +0200 |
| commit | 987124b09a32248414faf4d0d6615d43b29ac6f6 (patch) | |
| tree | a549db8af723c981d3b346e855f25d6fd5ff8aa7 /perllib/FixMyStreet/Cobrand/Base.pm | |
| parent | dbf56159e44c1560a413022451bf1a1c4cb22a52 (diff) | |
| parent | a085b63ce09f87e83b75cda9b9cd08aadfe75d61 (diff) | |
Merge tag 'v2.0.4' into fiksgatami-dev
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! |
