Lines 139-144
sub get_enabled_plugins {
Link Here
|
139 |
return @$enabled_plugins; |
139 |
return @$enabled_plugins; |
140 |
} |
140 |
} |
141 |
|
141 |
|
|
|
142 |
|
143 |
=head2 feature_enabled |
144 |
|
145 |
Returns a boolean denoting whether a plugin based feature is enabled or not. |
146 |
|
147 |
$enabled = Koha::Plugins->feature_enabled('method_name'); |
148 |
|
149 |
=cut |
150 |
|
151 |
sub feature_enabled { |
152 |
my ( $class, $method ) = @_; |
153 |
|
154 |
return 0 unless C4::Context->config('enable_plugins'); |
155 |
|
156 |
my $key = "ENABLED_PLUGIN_FEATURE_" . $method; |
157 |
my $feature = Koha::Cache::Memory::Lite->get_from_cache($key); |
158 |
unless ( defined($feature) ) { |
159 |
my @plugins = $class->get_enabled_plugins(); |
160 |
my $enabled = any { $_->can($method) } @plugins; |
161 |
Koha::Cache::Memory::Lite->set_in_cache( $key, $enabled ); |
162 |
} |
163 |
return $feature; |
164 |
} |
165 |
|
142 |
=head2 GetPlugins |
166 |
=head2 GetPlugins |
143 |
|
167 |
|
144 |
This will return a list of all available plugins, optionally limited by |
168 |
This will return a list of all available plugins, optionally limited by |