0

0

Drupal-7.12 创建节点类型

php中文网

php中文网

发布时间:2016-07-25 09:05:04

|

1549人浏览过

|

来源于php中文网

原创

drupal 站点开发

MediPro网上服装店系统
MediPro网上服装店系统

具有服装类网店的常用的功能和完善的商品类型管理、商品管理、配送支付管理、订单管理、会员分组、会员管理、查询统计和多项商品促销功能。系统具有静态HTML生成、UTF-8多语言支持、可视化模版引擎等技术特点,适合建立服装、鞋帽、服饰类网店。系统具有以下主要功能模块: 网站参数设置 - 对网站的一些参数进行个性化定义 会员类型设置 - 可以任意创建多个会员类型,设置不同会员类型的权限和价格级别 货币类型

下载
  1. function examplenode_install() {
  2. //Updates the database cache of node types
  3. node_types_rebuild();
  4. $types = node_type_get_types();
  5. // add the body field to the node type
  6. node_add_body_field($types['job_post']);
  7. // Load the instance definition for our content type's body
  8. $body_instance = field_info_instance('node', 'body', 'job_post');
  9. // Configure the body field
  10. $body_instance['type'] = 'text_summary_or_trimmed';
  11. // Save our changes to the body field instance.
  12. field_update_instance($body_instance);
  13. // Create all the fields we are adding to our content type.
  14. foreach (_job_post_installed_fields() as $field) {
  15. field_create_field($field);
  16. }
  17. // Create all the instances for our fields.
  18. foreach (_job_post_installed_instances() as $instance) {
  19. $instance['entity_type'] = 'node';
  20. $instance['bundle'] = 'job_post';
  21. field_create_instance($instance);
  22. }
  23. }
  24. /**
  25. * Return a structured array defining the fields created by this content type.
  26. * For the job post module there is only one additional field – the company name
  27. * Other fields could be added by defining them in this function as additional elements
  28. * in the array below
  29. */
  30. function _job_post_installed_fields() {
  31. $t = get_t();
  32. return array(
  33. 'job_post_company' => array(
  34. 'field_name' => 'job_post_company',
  35. 'label' => $t('Company posting the job listing'),
  36. 'type' => 'text',
  37. ),
  38. );
  39. }
  40. /**
  41. * Return a structured array defining the field instances associated with this content type.
  42. */
  43. function _job_post_installed_instances() {
  44. $t = get_t();
  45. return array(
  46. 'job_post_company' => array(
  47. 'field_name' => 'job_post_company',
  48. 'type' => 'text',
  49. 'label' => $t('Company posting the job listing'),
  50. 'widget' => array(
  51. 'type' => 'text_textfield',
  52. ),
  53. 'display' => array(
  54. 'example_node_list' => array(
  55. 'label' => $t('Company posting the job listing'),
  56. 'type' => 'text',
  57. ),
  58. ),
  59. ),
  60. );
  61. }
  62. /**
  63. * Implements hook_uninstall().
  64. */
  65. function examplenode_uninstall() {
  66. // Gather all the example content that might have been created while this
  67. // module was enabled.
  68. $sql = 'SELECT nid FROM {node} n WHERE n.type = :type';
  69. $result = db_query($sql, array(':type' => 'job_post'));
  70. $nids = array();
  71. foreach ($result as $row) {
  72. $nids[] = $row->nid;
  73. }
  74. // Delete all the nodes at once
  75. node_delete_multiple($nids);
  76. // Loop over each of the fields defined by this module and delete
  77. // all instances of the field, their data, and the field itself.
  78. foreach (array_keys(_job_post_installed_fields()) as $field) {
  79. field_delete_field($field);
  80. }
  81. // Loop over any remaining field instances attached to the job_post
  82. // content type (such as the body field) and delete them individually.
  83. $instances = field_info_instances('node', 'job_post');
  84. foreach ($instances as $instance_name => $instance) {
  85. field_delete_instance($instance);
  86. }
  87. // Delete our content type
  88. node_type_delete('job_post');
  89. // Purge all field infromation
  90. field_purge_batch(1000);
  91. }
复制代码


热门AI工具

更多
DeepSeek
DeepSeek

幻方量化公司旗下的开源大模型平台

豆包大模型
豆包大模型

字节跳动自主研发的一系列大型语言模型

通义千问
通义千问

阿里巴巴推出的全能AI助手

腾讯元宝
腾讯元宝

腾讯混元平台推出的AI助手

文心一言
文心一言

文心一言是百度开发的AI聊天机器人,通过对话可以生成各种形式的内容。

讯飞写作
讯飞写作

基于讯飞星火大模型的AI写作工具,可以快速生成新闻稿件、品宣文案、工作总结、心得体会等各种文文稿

即梦AI
即梦AI

一站式AI创作平台,免费AI图片和视频生成。

ChatGPT
ChatGPT

最最强大的AI聊天机器人程序,ChatGPT不单是聊天机器人,还能进行撰写邮件、视频脚本、文案、翻译、代码等任务。

相关专题

更多
go语言 注释编码
go语言 注释编码

本专题整合了go语言注释、注释规范等等内容,阅读专题下面的文章了解更多详细内容。

2

2026.01.31

go语言 math包
go语言 math包

本专题整合了go语言math包相关内容,阅读专题下面的文章了解更多详细内容。

1

2026.01.31

go语言输入函数
go语言输入函数

本专题整合了go语言输入相关教程内容,阅读专题下面的文章了解更多详细内容。

1

2026.01.31

golang 循环遍历
golang 循环遍历

本专题整合了golang循环遍历相关教程,阅读专题下面的文章了解更多详细内容。

0

2026.01.31

Golang人工智能合集
Golang人工智能合集

本专题整合了Golang人工智能相关内容,阅读专题下面的文章了解更多详细内容。

1

2026.01.31

2026赚钱平台入口大全
2026赚钱平台入口大全

2026年最新赚钱平台入口汇总,涵盖任务众包、内容创作、电商运营、技能变现等多类正规渠道,助你轻松开启副业增收之路。阅读专题下面的文章了解更多详细内容。

76

2026.01.31

高干文在线阅读网站大全
高干文在线阅读网站大全

汇集热门1v1高干文免费阅读资源,涵盖都市言情、京味大院、军旅高干等经典题材,情节紧凑、人物鲜明。阅读专题下面的文章了解更多详细内容。

73

2026.01.31

无需付费的漫画app大全
无需付费的漫画app大全

想找真正免费又无套路的漫画App?本合集精选多款永久免费、资源丰富、无广告干扰的优质漫画应用,涵盖国漫、日漫、韩漫及经典老番,满足各类阅读需求。阅读专题下面的文章了解更多详细内容。

67

2026.01.31

漫画免费在线观看地址大全
漫画免费在线观看地址大全

想找免费又资源丰富的漫画网站?本合集精选2025-2026年热门平台,涵盖国漫、日漫、韩漫等多类型作品,支持高清流畅阅读与离线缓存。阅读专题下面的文章了解更多详细内容。

19

2026.01.31

热门下载

更多
网站特效
/
网站源码
/
网站素材
/
前端模板

精品课程

更多
相关推荐
/
热门推荐
/
最新课程
Swoft2.x速学之http api篇课程
Swoft2.x速学之http api篇课程

共16课时 | 0.9万人学习

第三期培训_PHP开发
第三期培训_PHP开发

共116课时 | 26.2万人学习

关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号