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:


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

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

I'd like to remove the 'Delete' button of this form(which normally deletes the content). I have read that this is easily done with hook_form_alter() but my code resides within the header of a View and I'd like to keep it that way.

Is there a way to do this?

1 Answer 1


Found a solution, but if there is a better way I'd like to hear more.

$edit_page['actions']['delete']=false; //removed delete button
$edit_page['title']=false; //removed title display as well

Your Answer

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

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