Skip to main content
1 of 3

Custom redirect for form-edit displayed in Views header

I have a content type called 'Checklist' which I bring forward using Views.

I wrote PHP code within the header in order to do this, here it is:

<?php 
    $view = views_get_current_view();
    $arg0 = $view->args[0];
    $nodeToLoad = $view->result[0]->nid; //I get the node to load from Fields within my view
    module_load_include('inc', 'node', 'node.pages');
    $node = node_load($nodeToLoad);
    $edit_page = drupal_get_form('page_node_form', $node);
    $edit_page['additional_settings']['#access'] = FALSE;
    $edit_page['buttons']['submit']['#submit'][]="www.google.com";//this is what I used to redirect but it doesn't cut it.
    print drupal_render($edit_page );
?>

Now what I want is to add a custom redirect upon saving this particular form.

I've tried this to no avail:

    $edit_page['buttons']['submit']['#submit'][]="www.google.com";

Is it possible to this within the Views header?


Notes:

  • I have also done this with the Rules module but I'd like to learn if it's possible to do with PHP code in the Views header so I don't split functionality in 2 parts of my project.

  • This can also be easily done using a custom hook but again, if it's possible to do this within the Views header then that's the trick I'm looking for.

Thanks.