There is a checkbox to enable/disable hooks on Plugin Details.
Do "I" have to run/not_run my plugin code based on this setting? or does my plugin *not* get called automatically if this checkbox is set to "disable"?
I ask because I see in Andy's SearchFeed plugin, he has this code in Install.pm
and this in his hook...
my $inc = $opts->{Active};
if ($inc == 0) { return $results; }
if ($inc == 1 and $results->{link_hits} > 0) { return $results; }
I have *not* added ANY special option to enable/disable my plugin, yet I still have the checkboxes in Plugin Details.
So, do I have to add an option to run/not run my hook?
Or, can I just grab the GT setting on this hook and run/ not run based on that?
How do I access the enabled disabled setting from plugin config options?
'hooks' => [
[
'add_link',
'PRE',
'Plugins::ZipCodeSearch::add_link_hook',
'1'
],
[
'modify_link',
'PRE',
'Plugins::ZipCodeSearch::modify_link_hook',
'1'
]
],
I hope you understand what I am asking.
Thanks,
Chris
RGB World, Inc. - Software & Web Development.
rgbworld.com
Do "I" have to run/not_run my plugin code based on this setting? or does my plugin *not* get called automatically if this checkbox is set to "disable"?
I ask because I see in Andy's SearchFeed plugin, he has this code in Install.pm
Code:
$mgr->install_options ( 'SearchFeed_Results', [ ['Active', '1', 'Set to 0 if you don\'t want this plugin to be active, or 1 if you want the results to be grabbed...', 'TEXT', [], [], '' ] ] );and this in his hook...
Code:
my $opts = Links::Plugins->get_plugin_user_cfg ('SearchFeed_Results'); my $inc = $opts->{Active};
if ($inc == 0) { return $results; }
if ($inc == 1 and $results->{link_hits} > 0) { return $results; }
I have *not* added ANY special option to enable/disable my plugin, yet I still have the checkboxes in Plugin Details.
So, do I have to add an option to run/not run my hook?
Or, can I just grab the GT setting on this hook and run/ not run based on that?
How do I access the enabled disabled setting from plugin config options?
Code:
'ZipCodeSearch' => { 'hooks' => [
[
'add_link',
'PRE',
'Plugins::ZipCodeSearch::add_link_hook',
'1'
],
[
'modify_link',
'PRE',
'Plugins::ZipCodeSearch::modify_link_hook',
'1'
]
],
I hope you understand what I am asking.
Thanks,
Chris
RGB World, Inc. - Software & Web Development.
rgbworld.com