New content-type module breaks all other forms

jcerdan - September 10, 2008 - 17:25

Hi,

I am trying to develop a module for a new content-type in Drupal and I followed the doc for Drupal 6, and looked for other modules. The problem I have is that when I enable my module in the module list, anonymous users can't see any form on the site (nor the login form, neither the contact form).
If I disable the module, anonymous users can again see the forms.

I really don't know what happens.

Here is the code for the depuradores.module file:

<?php
/**
* Implementation of hook_node_info().
*/
function depuradores_node_info() {
  return array(
   
'depuradores' => array(
     
'name' => t('Depuradores dades'),
     
'module' => 'depuradores',
     
'description' => "depuradores content",
    )
  );
}

/**
* Implementation of hook_perm().
*/
function depuradores_perm() {
  return array(
'create depuradores', 'edit own depuradores');
}

/**
* Implementation of hook_access().
*/
function depuradores_access($op, $node) {
  global
$user;

  if (
$op == 'create') {
   
// Only users with permission to do so may create this node type.
   
return user_access('create depuradores');
  }

 
// Users who create a node may edit or delete it later, assuming they have the
  // necessary permissions.
 
if ($op == 'update' || $op == 'delete') {
    if (
user_access('edit own depuradores') && ($user->uid == $node->uid)) {
      return
TRUE;
    }
  }
}

/**
* Implementation of hook_form().
*/
function depuradores_form(&$node) {
 
$type = node_get_types('type', $node);

 
// We need to define form elements for the node's title and body.
 
$form['title'] = array(
   
'#type' => 'textfield',
   
'#title' => check_plain($type->title_label),
   
'#required' => TRUE,
   
'#default_value' => $node->title,
   
'#weight' => -5
 
);
 
// We want the body and filter elements to be adjacent. We could try doing
  // this by setting their weights, but another module might add elements to the
  // form with the same weights and end up between ours. By putting them into a
  // sub-array together, we're able force them to be rendered together.
 
$form['body_filter']['body'] = array(
   
'#type' => 'textarea',
   
'#title' => check_plain($type->body_label),
   
'#default_value' => $node->body,
   
'#required' => FALSE
 
);
 
$form['body_filter']['filter'] = filter_form($node->format);

 
// NOTE in node_example there is some addition code here not needed for this simple node-type

 
return $form;
}

/**
* Implementation of hook_help().
*/
function depuradores_help($section) {
  switch (
$section) {
    case
'admin/help#depuradores':
      return
t('Text dajuda per a les dades de les depuradores');
      break;
  }
}
?>

As you can see, it's mainly based on the code found on api.drupal.org.

And here is the file depuradores.info:

; $Id$
name = Depuradores
description = conserva i mostra les dades de les depuradores
core = 6.x
dependencies[] = charts

Can anyone point me to a solution?

Adding info

jcerdan - September 10, 2008 - 17:28

I forgot to say that instaed of the form, I get "Array" printed on the page.

 
 

Drupal is a registered trademark of Dries Buytaert.