Drupal随笔

博客分类: 
  1. 使用hook_form_alter和CCK创建的字段结合修改表单。参照:http://drupal.org/node/726282
  2. Drupal中安装一个数据表,常用的有3个hook
    hook_install()//安装
    hook_uninstall()//卸载
    hook_shema()//数据结构
    另外有两个函数:
    drupal_install_schema()
    drupal_uninstall_schema()
    其中需要注意的是drupal_install_schema($module)
    里面的参数是hook或者直接叫做module名。
    假设我有安装模块test,那么应该有:
    test_install(){
    drupal_install_schema('test');
    }
    test_uninstall()
    {
    drupal_install_schema('test');
    }

    test_schema(){
    $schema['my_first_table']=array(
    'description' => '...',
    'fields'=>array(),
    //...
    );
    return $schema;
    }

You voted 5. Total votes: 1958

添加新评论