Skip to main content
added 126 characters in body
Source Link

I have a content type called 'Checklist' which I bring forward using Views, in it's node-edit form.

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);
    dsm($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$edit_page['buttons']['submit']['#submit'][] is= what'redirect_submit';
 I used to redirectprint butdrupal_render($edit_page it);

 doesn't cut it. function redirect_submit($form, &$form_state){
    print drupal_render($edit_page );  $form_state['redirect'] = 'www.google.com';
    }
?>

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$edit_page['buttons']['submit']['#submit'][] = 'redirect_submit';
    print drupal_render($edit_page );

    function redirect_submit($form, &$form_state){
        $form_state['redirect'] = 'www.google.com";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.

I have a content type called 'Checklist' which I bring forward using Views, in it's node-edit form.

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.

I have a content type called 'Checklist' which I bring forward using Views, in it's node-edit form.

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);
    dsm($nodeToLoad);
    $edit_page = drupal_get_form('page_node_form', $node); 

    $edit_page['additional_settings']['#access'] = FALSE;
    $edit_page['buttons']['submit']['#submit'][] = 'redirect_submit';
    print drupal_render($edit_page );

    function redirect_submit($form, &$form_state){
        $form_state['redirect'] = 'www.google.com';
    }
?>

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'][] = 'redirect_submit';
    print drupal_render($edit_page );

    function redirect_submit($form, &$form_state){
        $form_state['redirect'] = '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.

added 24 characters in body
Source Link

I have a content type called 'Checklist' which I bring forward using Views, in it's node-edit form.

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.

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.

I have a content type called 'Checklist' which I bring forward using Views, in it's node-edit form.

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.

Source Link

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.