I have written my first module. It is a knockoff of the multi-page Forms API working example. I enabled it in Administer->Settings and all seems well.

That module has created a new Content type. When I create a "new" version of this by going to Content=>Create Content=>NewContentType it creates a new node patterned after the NewContentType.

That all works fine.

Let's assume that I do the above and create a new node (node=59). If I then create a menu link to mysite/node/59 it will display both a "view" tab and an "edit" tab when I navigate to that node.

Is there any way to disable the 'view' tab?

The entire purpose of this new content type is to collect information from the user. There is never any need to display it back, except in the form it already is on the edit screens. I suppose it would be trivial to change that which displays on the 'view' tab by adding something like: $node->body = ''; just before hook_view() ends. But I'd rather disable the view 'tab' if I could.

Comments

drupal777’s picture

Assume that I have a module named "mymodule". I then merely need to add the following to mymodule.module:

function mymodule_access($op, $node) {

  if ($op == 'view') {
    return FALSE;
  }
  else {
    return TRUE;
  }
 
 }

Does anybody think there is a better way?

drupal777’s picture

Can anybody think of why that code wouldn't ever be reached? What could I have put in my module that would have disengaged it? First, it doesn't preclude me "submitting" while on the edit tab and the system then showing me the view tab and the contents of the view.

Second, if I put debug statements in to have the values of $op and $node displayed, nothing is, which leads me to believe that the function is never being called.

What might I have done to cause this?