4.1 实体,内容实体和配置实体

Drupal 7 龤龢龠龝龚(entities)龄龃龁齽齹齵齲齰齭齩齧齦齣齢齟齞齜齚

齙齕齓齒齏齎龝龚齌齹齵齉齩齅 Drupal 7 齌齁鼽齲Drupal 7 齌鼻鼸鼷齕鼴龃龝龚鼳鼲鼯鼬鼨鼥nodes鼞鼝鼜鼙鼥 comments鼞鼝 鼐鼏鼥terms鼞鼍鼌鼋鼥users鼞齚

齽鼈鼇鼃鼀黽 Drupal 7 鼻鼸齌龝龚 API齲黲齽黮黭黬黩黨黤黭黢黠 Entity API 齲黚黤黭黢黠黖黔黓黏龝龚鼍黌黊齌黇鼇黅黂齚龄龃黢黠麾麺麹鼇龃龝龚 CRUD鼥Create, Read, Update 鼍 Delete鼞 麫麧麥齲鼌齧麤麡麝齌龝龚鼳鼲齚

Drupal 7 麚麗齲鼷齕鼬鼨鼥nodes鼞麖麕麓麏齚麋麈麄麀鹾 Drupal 7 鼻鼸鹺鹸鹴鹲麡黢鹱龝龚鹯齲麾麖齎齣鼜鼙鼝鼐鼏鼍鼌鼋鹫鹪麕麓齚

麄麀 Drupal 8 齌鹤鹠齲Drupal 鹞鹝齕鹜鹙鹗鹕鹒鹐鹍黏鹊鹇龝龚鼍麕麓鼥 黬 5 鸿鸼鸻鸸鸴鸱鸮 鼞齚

实体和实体类型

鼇龃龝龚鼥鸫 Drupal 7 齩 An introduction to entities 鸧鸤鸠齌鸝鸛鼞齅鼇龃鸗鸕齉齩齌齢齟齚Drupal 8 鸧鸔鸓鸒鸎鸤鸠鹱鼇鸍鸉鸤鼳鼲齌齢齟齲鸆鼇龃龝龚齅鼇龃龝龚鼳鼲鼥鼇鸍鸄鸀齌鷾齟鼞齌龝鷺齚龄鷷鷶鷲鷮鷫鹾麕麓鷪鷩鹱麖鷧鼌齌鷣鷟齚Drupal 8 鸧鸱鸮鼳鼲齅龝龚鼳鼲齌鷞鷚齲龝龚鼳鼲齅鷗鹗鼌齌鷕鷒齚

鼇鷑鷐鷌齌龝龚鼳鼲齅鼯

  • 鼬鼨鼥鸱鸮鼳鼲鼞
  • 鼜鼙
  • 鹲鼳鷕鷒
  • 鼌鼋鷉鷅
  • 鹒鹐龝龚

另一种方式看待实体类型

鸆鼇龃龝龚鼳鼲麖齎齕鷄鷀鶿鶽齌鼳鼲齲鶹鶸鶴鸤鼥 bundles 鼞齚鷺鶰鼬鼨龝龚鼳鼲齌鶴鸤鶹鶸鸱鸮鼳鼲鼥 content types 鼞齚鼬鼨麾齅鶭鼇鼇龃鶬鶨龠鶴鸤鶦鶢齌龝龚鼳鼲齲鶠鹱鶜齩 WEB 黅黂鸧鶓鼌齌鹗鶐鶦鶢齚

麾麖齎黏鶌鹱龝龚鶋齕鶴鸤齲鸱鸮鼳鼲齅鼬鼨龄龃龝龚鼳鼲鹱鶜齌齙齕鶴鸤鶈齌鶇鶦鼝黇鶢齚

鹗鹕鶆鶃麏鶀鸓齌龝龚齲鶀鸓鵽鹤鶆鶃麏齌鵼鵺黢鷟鼝鷣鷟鼍鷄鷀齌龁鵷齲Drupal 鵶鼌齌鵲鸔鹴鹲麾鵰鵭鶆鶃麏鹱鵩鸍龝龚鶴鸤鼳鼲齚

配置实体

Drupal 8 龤龢龠 鹒鹐龝龚 齹齵齲鶜鸼鵦鼌龝龚鵢黇齌 CRUD 鼍麖鵠鵜齉鵛鵘鹜齚龄鵕鵒鹗鹒鹐齌鷄鷀麚黓齩齧齲鸔鸓鹗鷐齅鼌鼋麤麡齌鼝鵏鹝鷐黲齽鵌鷮鼍鵈鵶鵆鷞鼥hooks鼞齚

鵀齩齌鹒鹐龝龚鷺鷞麺麹鼯

  • 鸱鸮鼳鼲鼥Content types鼞
  • 鴿鴾鼥views鼞
  • 鹲鼳鼐鼏鴵鼥Taxonomy vocabularies鼞
  • 鴯鵢鴵鴮鼥Contact forms鼞
  • 鴾鴪鸛鷟鼥Image styles鼞

齽鸤鸠麝齌鹒鹐龝龚鼳鼲齲鴦鵶鴣鴢鴞 ConfigEntityBase 鼳齚鹒鹐龝龚鴝麗鷄鴙鴘鴔鴐鶿鶽鼥 RevisionableInterface 鼞齚

创建内容类型

麤麡鸱鸮鼳鼲鴍鸮鴉齌黨鷟齅鹗鹕鼌鼋鴈齦齚 Using an entity reference 鴄鴂龠鴁鸛麤麡鸱鸮鼳鼲鼥鴀黬 5 鼃鷲鳽鼞齚

Drupal.org 麾麺鳸鴁鸛麤麡鸱鸮鼳鼲齌鼇龃 example

鶓鼌 Console 麤麡鼇龃鸱鸮鼳鼲

鳶鼇鸍麤麡龝龚齌黨鷟齅鶓鼌 Console 鳴齁齚

Console 鹜鳳鼯

  • 鹊鹇 moudle 鼍 info 鳯鳫齚
  • 鹱黢黠鹇鳧 PSR-4 鼽鳘齌齁鳔鳒鳏齚
  • 齩 YAML 鳯鳫鳃鳀鲽黚齲鲼鲸鹤麫麧麥鼍鴵鴮齌 PHP 鼳齚
  • 麤麡鼳齲鲲鹪鶦麕鲯鲫鼝uses齲黲齽鲪麾麖齎齕 extend implements 鲦鲥麕齚
  • 鴙鴘鼳鹊鹇鲪鹗鹕鲢鲞鳃龢鲲鹪 services 齚

评论 (写第一个评论)