0

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?

2
  • With view you mean a simple data output and not a view from Views module? What do you mean to add the form to the view? They could beas well separate pages.
    – Wtower
    Commented Jan 29, 2014 at 10:03
  • I want to embed my form in view (from views module)
    – NickF
    Commented Jan 29, 2014 at 13:35

1 Answer 1

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.