0

I am trying to programmatically insert custom content on dynamically generated pages.

For example, how would I want to insert content on the default webform submission confirmation page.

Since the webform confirmation page is a dynamically generated page and not a node, this is a problem.

Can anyone give me suggestions on how to programmatically add content to a dynamic Drupal page?

sisko
  • 9,604
  • 20
  • 67
  • 139

1 Answers1

0

As i understood you need to output some content when you submit your webform, so you need to provide custom submit handler for that webform, and output information what you want.

You will need to alter your form with hook_form_alter

function YOURMODULENAME_form_alter(&$form, &$form_state, $form_id) {
   if ($form_id == 'your_form_id_here') {
     $form['#submit'][] = 'myform_form_submit';
   }
}

Now in your myform_form_submit you can output some stuff like this:

function myform_form_submit(&$form, &$form_state) {
   drupal_set_message('Any stuff here');
}

Also you can redirect user to any page you want, and show your custom content there. With $form_state['redirect'] = 'YOUR_DESTINATION'; or drupal_goto function

Petro Popelyshko
  • 1,353
  • 1
  • 15
  • 38
  • Thanks neok for the response. I already a custom submit handler which works but I want to insert content not put a notice using something like drupal_set_message. The content area is where I am trying to access programmatically so I can insert my content – sisko Apr 11 '13 at 12:56