Hi there,
I'm trying to do a pre_hook into form_link and form_display like this:
[
'form_link',
'PRE',
'Plugins::Custom::custom_form_link',
'1'
],
Then in Custom.pm I have this code:
sub custom_form_link {
# -------------------------------------------------------------------
# This subroutine will get called whenever the hook 'form_link'
# is run. You should call GT::Plugins->action ( STOP ) if you don't
# want the regular code to run, otherwise the code will continue as
# normal.
#
my ($self, $opts) = @_;
$self->{code}->{Business_Hours} = \&form_hours;
return ($self,$opts);
}
The problem is that when the rest of GT's code gets run, I lose all Expiry_Form code and the Username code that GT created.
I looked in Links::HTML::Links.pm and found the following in _plg_form :
sub _plg_form {
# -------------------------------------------------------------------
# Displays a form.
#
my ($self, $opts) = @_;
$self->{code}->{ExpiryDate} = \&form_expiry;
GT's $self->{code} contains the form_expiry
but $opts->{code} contains my disp_hours (shouldn't this be in $self?)
The real problem is that the resulting form displays my custom_form element, but not GT's
so it seems that I'm not passing back the information from my plugin properly OR $self is not passed through to my plugin, but I can't figure out what I'm doing wrong, or maybe this kind of plugging in isn't possible?
Any ideas?
peace.
klangan
I'm trying to do a pre_hook into form_link and form_display like this:
[
'form_link',
'PRE',
'Plugins::Custom::custom_form_link',
'1'
],
Then in Custom.pm I have this code:
sub custom_form_link {
# -------------------------------------------------------------------
# This subroutine will get called whenever the hook 'form_link'
# is run. You should call GT::Plugins->action ( STOP ) if you don't
# want the regular code to run, otherwise the code will continue as
# normal.
#
my ($self, $opts) = @_;
$self->{code}->{Business_Hours} = \&form_hours;
return ($self,$opts);
}
The problem is that when the rest of GT's code gets run, I lose all Expiry_Form code and the Username code that GT created.
I looked in Links::HTML::Links.pm and found the following in _plg_form :
sub _plg_form {
# -------------------------------------------------------------------
# Displays a form.
#
my ($self, $opts) = @_;
$self->{code}->{ExpiryDate} = \&form_expiry;
GT's $self->{code} contains the form_expiry
but $opts->{code} contains my disp_hours (shouldn't this be in $self?)
The real problem is that the resulting form displays my custom_form element, but not GT's
so it seems that I'm not passing back the information from my plugin properly OR $self is not passed through to my plugin, but I can't figure out what I'm doing wrong, or maybe this kind of plugging in isn't possible?
Any ideas?
peace.
klangan