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 齜

评论 (写第一个评论)