I'm trying to develop a module that creates a form and a view that displays that page.
In my module I used hook_menu()
and hook_form()
.
Also I saw some tutorials 1 & 2
What I cannot understand where & how to add my form to the view?
I'm trying to develop a module that creates a form and a view that displays that page.
In my module I used hook_menu()
and hook_form()
.
Also I saw some tutorials 1 & 2
What I cannot understand where & how to add my form to the view?
I have never used it in that way, but some thoughts:
The second link doesn't seem relevant, as I suppose that you use Views 3.
If you use the approach described in the first link, than you don't need to implement hook_form()
in your module, instead you need to create a views field handler and there you need to define the methods views_form()
and views_form_submit()
, optionally also views_form_validate()
. You would then "add the form to the view" using the Views UI where you can add the field (the one that you have written a handler for) to the display. That's how your handler get's called and is responsible for the rendering of the element, which usually renders a value wrapped in some markup, but in your case it would render a form.
The first link explains that all very well. Just go through it again and try to follow it in detail.