我正在尝试创建我的第一个 drupal 模块,该模块创建一个简单的节点类型 wcNames。此节点类型有两个字段,名字和姓氏。我可以让我的模块为节点类型创建数据库表并将其添加到 node_type 表中,但是当我打开节点/添加/wc-name 字段时,名字和姓氏不会出现。下面是我的代码。请建议。
<?php
// wc_name.install file 
/*
 * hook_schema Implementation: Creates the DB and it's fields
 */
function wc_name_schema(){
    $schema['wc_name_names'] = array(
    'fields' => array(
      'nmid'              => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE),
      'firstname'        => array('type' => 'varchar', 'length' => 50, 'not null' => FALSE),
      'lastname'         => array('type' => 'varchar', 'length' => 50, 'not null' => FALSE),
    ),
    'primary key'        => array('nmid'),
    'unique keys'        => array(),
    'indexes' => array(
      'nmid'       => array('nmid'),
    ),
  );
    return $schema;
}
//function wc_name_install(){ } // Use this function to set variables for the module. 
function wc_name_uninstall(){ 
    //unset variables if any set 
   // Delete all wc_name nodes
  db_delete('node')->condition('type', 'wc_name')->execute();
  // Delete all wc_name tables
  db_drop_table('wc_name_names');
}
?>
<?php
// wc_name.module
/*
 * Implementation of _node_info(): define node
 */
function wc_name_node_info(){
    return array(
    'wc_name' => array(
      'name' => t('wcName'),
      'base' => 'wc_name',
      'base' => 'page',
      'description' => t("A smaple module to save names."),
      'has_title' => TRUE,
      'title_label' => t('Title'),
      'has_body' => FALSE,
    )
  );
}
function wc_name_menu() {
  $items = array();
  $items['wc_name'] = array(
    'title' => 'wcNames',
    'page callback' => 'wc_name',
//   'access arguments' => array('access wcNames'),
  );
}
?>
<?php
// wc_name_form.inc 
function wc_name_form($node, &$form_state){
    // Add fields
    $form['first_name'] = array(
    '#type' => 'textfield',
    '#title' => t('First name'),
    '#required' => FALSE,
    '#default_value' => $node->wc_name['firstname'],
  );
    $form['last_name'] = array(
    '#type' => 'textfield',
    '#title' => t('Last name'),
    '#required' => FALSE,
    '#default_value' => $node->wc_name['lastname'],
  );
    return $form;
}
?>
我错过了什么?