快轉到主要內容

Drupal

Drupal7中自定义表格输入

Drupal7中自定义表格输入

·1240 字·3 分鐘
Drupal默认的节点表单(entity form)输入有时候并不能满足我们的需求,比如我想做一个类似excel表格输入形式的表单呢? = DEMO点这里 (PS. 用Pantheon的sandbox做了一个随意折腾的drupal站点,真的是折腾死我了= =) 首先,新建一个自定义模块,在你的*.module文件中hook_menu() 指定一个页面路径,设置页面调用表单,比如这样:
Drupal7 中Restful模组应用简单介绍

Drupal7 中Restful模组应用简单介绍

·1918 字·4 分鐘
安装并启用Restful Module # Restful 2.x 下载 drush 安装 drush dl restful, drush en restful 自定义RESTFUL API模组 # 可参考restful里的范例 sites/all/modules/restful/modules/restful_example 或者测试文件内容 sites/all/modules/restful/tests 模组文件结构 # 1custom_restfulapi/ 2├─ src/ 3│ ├─ Plugin/ 4│ │ ├─ resource/ 5│ │ │ ├─ entity/ 6│ │ │ │ ├─ Testentity__1_0.php 7├─ custom_restfulapi.info 8├─ custom_restfulapi.module API RESOURCES要放在src/Plugin下。 *.info 和 *.module 的内容跟其他自定义模组的相差无几,方法一样,此处从略。
drupal中获取 entity reference field 的 node type 值

drupal中获取 entity reference field 的 node type 值

·421 字·1 分鐘
标题很拗口我知道…… 用过 entity reference 模组的朋友都知道,这个模组(module)能让你在节点(node)中添加一个 Entity Reference 的字段(Field),可以引用其他的实体(entity)。此次添加引用的是节点。根据需求,须输出节点类型(node type),但是 entity reference 的字段只能输出被引用实体的ID(本例是 nid),所以……