Gossamer Forum
Home : Products : Gossamer Links : Discussions :

form_link self->code problem

Quote Reply
form_link self->code problem
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
Subject Author Views Date
Thread form_link self->code problem klangan 8127 Jun 9, 2005, 1:42 PM
Thread Re: [klangan] form_link self->code problem
afinlr 8011 Jul 19, 2005, 3:00 PM
Thread Re: [afinlr] form_link self->code bug
klangan 8026 Jul 19, 2005, 3:17 PM
Post Re: [klangan] form_link self->code bug
afinlr 7995 Jul 19, 2005, 3:20 PM
Thread Re: [klangan] form_link self->code bug
afinlr 7878 Mar 22, 2007, 11:39 AM
Thread Re: [afinlr] form_link self->code bug
klangan 7873 Mar 22, 2007, 1:41 PM
Thread Re: [klangan] form_link self->code bug
afinlr 7876 Mar 22, 2007, 2:24 PM
Thread Re: [afinlr] form_link self->code bug
klangan 7872 Mar 22, 2007, 2:50 PM
Post Re: [klangan] form_link self->code bug
afinlr 7880 Mar 22, 2007, 3:01 PM
Thread Re: [afinlr] form_link self->code bug
brewt 7870 Mar 22, 2007, 3:27 PM
Thread Re: [brewt] form_link self->code bug
afinlr 7854 Mar 22, 2007, 4:36 PM
Thread Re: [afinlr] form_link self->code bug
brewt 7856 Mar 22, 2007, 4:41 PM
Post Re: [brewt] form_link self->code bug
afinlr 7847 Mar 22, 2007, 5:18 PM
Thread Re: [brewt] form_link self->code bug
afinlr 7842 Mar 24, 2007, 12:42 PM
Thread Re: [afinlr] form_link self->code bug
afinlr 7842 Mar 24, 2007, 6:20 PM
Thread Re: [afinlr] form_link self->code bug
afinlr 7835 Mar 24, 2007, 8:27 PM
Post Re: [afinlr] form_link self->code bug
afinlr 7844 Mar 25, 2007, 11:18 AM