SlideShare uma empresa Scribd logo
1 de 75
Baixar para ler offline
Entities, Bundles, and Fields 
Ted Bowman 
sixmiletech.com
TTeedd BBoowwmmaann 
 tedbow @ drupal.org & twitter 
 sixmiletech.com 
 Training and Consulting
Entities, Bundles, and Fields 
Contact Us for: 
●Staff Training 
●1 on 1 Consulting 
●Client Training 
●Online Classes
Entities, Bundles & Fields 
 You Need to Understand 
This! 
 Why?!?
In Drupal you often? 
 Use Different Entity types 
 Install modules that create entities 
 Create new Bundles 
 Create new Fields 
 Attach existing Fields to Bundles
Drupal let's you know when you. 
 Use Different Entity types 
 Install modules that create entities 
 Create new Bundles 
 Create new Fields 
 Attach existing Fields to Bundles
Drupal's UI Doesn't Metion 
 Entity Types 
 Bundles
Entity Types & Bundles 
 Key concepts about how Drupal Works! 
 You Need to Learn this
Understanding Entity Types & Bundles 
 Help you choose modules 
 Help you understand how modules work 
 Views 
 Rules 
 Profile2 
 Others....
What are Entities and Bundles? 
 Entity Types - core 
 Nodes 
 Terms 
 Users 
 Comments 
 Files (non-fieldable)
What are Entities and Bundles? 
 Entity Type - contrib 
 Profiles – Profile2 
 Media asset – Media 
 Commerce Line Item 
 etc..
Drupal 8 Entities 
 More Core Entities 
 Configuration Items are (non-fieldable) Entities 
 Node type 
 Menu Link 
 Date format 
 32+ Entity types in Core 
 Entities are Classed Objects
Entities of same type 
 Share Properties 
 All Nodes 
 Sticky 
 Published 
 Changed Date 
 Created Date 
 All Comments 
 Subject 
 Node ID
How to spot an entity type
How to spot an entity type
Bundles 
 Most Entity types divided into 
Bundles
What are Entities and Bundles? 
Bundles 
 Node -> 
Article 
Basic Page
What are Entities and Bundles? 
Bundles 
 Term -> 
Keywords 
Tags
What are Entities and Bundles? 
Bundles 
 User-> 
User 
? 
 Some Entity types can only 
have 1 bundle
What are Entities and Bundles? 
 Bundles 
 User 
User 
 Roles aren't bundles
How to spot a bundle
How to spot a bundle
How to spot a bundle
Why haven't I heard of bundles? 
 Not labeled bundles in Drupal UI 
 Referred to by different names per Entity type 
 Nodes = “content type” 
 Terms = “vocabulary” 
 Profile2 = “profile type”
Bundle Properties
Bundle Properties
An Entity 
 Individual instance of an Entity type 
 Every Entity belongs to a bundle (even users) 
 Examples 
 User:User 
 admin User 1 
 Node:Blog Entry 
 Individual Blog post 
 Term:Tag 
 The Tag “awesome“
Entity types - SQL Backend 
 All entities of a type share a “base 
table” 
 Not separated by bundle 
 Table column specifies bundle(if more 
than 1 bundle) 
 Easy to query entities of same type 
but different bundles
Entity types - SQL Backend
What about Fields? 
 Entity Types can be fieldable or non-fieldable 
 Each Bundle can have different fields 
 All entities of a specific Bundle will have the 
same fields
What about Fields? 
 Fields can be shared between Entity Types 
 For example 
 Field State (field_state) 
 User:User:field_state 
 Node:Event:field_state 
 Profile2:Company:field_state 
 Not in Drupal 8! 
 Shared between Bundles within Entity Type
Sharing Fields 
●Using Views 
● CAN DO 
● List all nodes by where field_state = FL 
● NO CAN DO 
● List all nodes and users where field_state = FL 
● Because 
● Pages, Articles, Webforms, etc – Same table 
● Nodes and Users aren't stored in the same table
What about Fields? 
 Examples 
 Nodes 
 Article(bundle) 
 body, tags, image 
 Basic Page(bundle) 
 body 
 Users 
 User(bundle not seen) 
 Address Field
Field Lingo 
 Base field 
 Definition of Field 
 Field instance 
 Base field attached to a bundle
Field Lingo - Example 
 Field State (field_state) – Base Field 
 User:User:field_state – Field Instance 
 Node:Event:field_state – Field Instance 
 Profile2:Company:field_state – Field Instance
Field Lingo 
 Creating a New Field 
 Form #1 – Base Field 
 Form #2 – Field Instance 
 Re-using Field 
 Form #1 – Field Instance
Fields – SQL Backend 
 For all field instances of base field 
 1 table - Current Data 
 1 table – Revision Data 
 For Example 
 field_data_field_tags 
 field_revision_field_tags
Field – SQL Backend 
field_data_field_tags
Entity API – Drupal 7 Contrib 
 Entity Helper Functions 
 Dependency of Many Contrib Entity Modules 
 Provides Views and Rules Support 
 Makes life easier for Contrib Maintainers
Entities and Views 
 Views Can 
 List Entities of different Bundle but same type 
 Views Can't 
 List Entities of different Entity types
Entities and Rules 
 Rules Can 
 React to all Entity Events 
 Create New Entities 
 Figure out entity fields and properties
Programmer Helpers 
 EntityFieldQuery 
 Easily Query Entities 
 Filter by Field Values 
 Filter by Properties 
 EntityMetaData Wrappers 
 Easily Read and Set fields and properties
Modules: New Entities 
 Profile2 
 Entityforms 
 Entity Contruction Kit
●Profile2: Fieldable User Profiles 
 http://drupal.org/project/profile2 
 Provides multiple profiles for users 
 Can restrict Profiles based on Role 
 Why it's cool! 
 Kind of like Bundles for users 
 User entity type has 1 bundle “user“ 
 Let's different roles have different fields 
 Example 
 Blogger Profile for fields that pertain only to 
bloggers
●Profile2: How it works 
 2 Entity types 
 Profile Type 
 Not fieldable 
 Contains bundle information “bundle of“ 
 Profile 
 Fieldable
●Profile2: Example 
 User Joe has a “blogger“ profile 
 Instance of Profile entity 
 Bundle = “blogger profile“(profile type) 
 Fields 
 How long have you been blogging?(integer 
field) 
 Favorite Blog post (entityreference)
Profile 2: Why another Entity Type? 
 Why not use a content type? 
 Different Properties 
 No Published status, sticky, etc. 
 Different behaviors 
 1 profile per bundle per user(at most) 
 No comment attached 
 Seperation for contrib modules 
 Rules 
 Views
●Entityforms: Fieldable Forms 
http://drupal.org/project/entityform 
 Provides fieldable forms for surveys, polls, etc. 
 Why it's cool! 
 Allows use of any Drupal Field in forms 
 Provides automatic Rules, Views integration 
 Reduces amount of code needed 
 I made it! 
 Example 
 Create surveys with Geofields
●Entityforms: How it works 
 2 Entity types 
 Entityform Type 
 Not fieldable 
 Contains bundle information “bundle of“ 
 Entityform (submission) 
 Fieldable
●Entityform: Example 
 Customer Survey 
 Instance of Entityform entity 
 Bundle = “customer_survey“(Entityform type) 
 Fields 
 How was your experience?(Long text) 
 Employ who helped you (entityreference)
Entityforms: Why not Webforms? 
 Use any Drupal Field 
 Field Collection, Addressfield, Entityreference 
 Rules integration 
 Knows all values of the submissions 
 Views integration 
 Knows all values of the submissions 
 Easy to extend
●Entity Construction Kit: ECK 
http://drupal.org/project/eck 
 Create Entity Types and Bundles through the 
browser 
 Why it's cool! 
 Allows creation of new Entity Types without 
coding 
 Provides developer framework for creating 
Entity Types 
 Example 
 Employ Entity
Does X module provide an Entity type? 
 Read the Docs! 
 Docs don't say! What Docs? 
 Search Files for: 
 “Implements hook_entity_info().”
Making Your Own Entities 
 Storing data in you own table? 
 Make it an entity! 
 Implement hook_entity_info 
 Thats it! (if you don't want a UI)
Modules: New Fields & Entities 
 Field Collections 
 Organic Groups 
 Drupal Commerce
●Field Collections 
http://drupal.org/project/field_collection 
 Fields that fieldable Entities 
 Why it's cool! 
 Allows bundling Fields together 
 Like Field Groups but with multiple values and 
reuse 
 Example 
 Reuse a Business Info Field Collection in 
Entityform Type, Profile2, and Node
●Field Collections: How it works 
 Entity Type: field_collection_item 
 Bundle: Each Field Collection Field 
 Fields attached to bundle
Field Collections: Why not use a 
reference? 
 Field Collection Item always have a parent 
entity 
 Field Collection Items are deleted when parent 
is deleted 
 Relationship is built in 
 Field Collection don't need their own properties
Field Collections
Organic Groups 
 https://drupal.org/project/og 
 Why it's cool! 
 User Create-able Groups 
 Example 
 Team Content Type
Organic Groups 
 Fields 
 Provides new Widgets and Behaviors for Existing 
Field types 
 Make a Node a Group 
 Boolean Field 
 Make Groups content 
 Entity Reference + OG Reference Widget 
 Content Visibility 
 List Field
Organic Groups 
 New Entity Types 
 Membership Types 
 Membership 
 Allows 
 Different Fields per Membership Type 
 Rules to react to subscriptions
Drupal Commerce 
 https://drupal.org/project/commerce 
 Why it's cool! 
 Everything is an Entity 
 Super Flexible Commerce System
Drupal Commerce 
 Entity Types 
 Payment Transaction 
 Products 
 Orders 
 Customer Profile 
 Line Item 
 Order
Drupal Commerce 
 Field Types 
 Line Item Reference 
 Customer Profile Reference 
 Price 
 Etc...
Drupal Commerce 
 Built on Entities and Fields 
 Drupal Community Benefited 
 Address Field Module 
 Inline Entity Form 
 Etc...
Module Selection 
References 
vs 
Entity Reference
References Module 
Provides: 
 User Reference Fields 
 Node Reference Fields
Entity Reference Module 
Provides: 
 Entity Reference Field 
Works with any Entity Type
Winner???? 
References 
vs 
Entity Reference
Winner!!!! 
Entity Reference 
More Flexible
Evaluating Modules 
 Does module X store new Data Type? 
 Is Data stored in a new Entity Type? 
 Is Entity Type Field-able? 
 Does module x use Entity API? 
Yes = More Flexible, Less Code, More Integration
Evaluating Modules 
 Does module X attach data to existing Entity 
Types? 
 Is data stored in a Field? 
 Is module Entity agnostic? 
Yes = More Flexible, More Control, More 
Integration 
Maybe less code 
Performance?
Entity Hooks 
 Provided by Entity API 
 Other modules can react to/ alter: 
 Create 
 Update 
 Delete 
 View
Entities, Bundles, and Fields 
Ted Bowman 
sixmiletech.com 
@tedbow 
Questions?

Mais conteúdo relacionado

Destaque

Successes and Challenges When Managing Large Scale Drupal Projects
Successes and Challenges When Managing Large Scale Drupal ProjectsSuccesses and Challenges When Managing Large Scale Drupal Projects
Successes and Challenges When Managing Large Scale Drupal ProjectsAcquia
 
Speedrun: Build a Website with Panels, Media, and More in 45 Minutes
Speedrun: Build a Website with Panels, Media, and More in 45 MinutesSpeedrun: Build a Website with Panels, Media, and More in 45 Minutes
Speedrun: Build a Website with Panels, Media, and More in 45 MinutesAcquia
 
Building a Custom Theme in Drupal 8
Building a Custom Theme in Drupal 8Building a Custom Theme in Drupal 8
Building a Custom Theme in Drupal 8Anne Tomasevich
 
Drupal 8 Quick Start: An Overview of Lightning
Drupal 8 Quick Start: An Overview of LightningDrupal 8 Quick Start: An Overview of Lightning
Drupal 8 Quick Start: An Overview of LightningAcquia
 
Lightning Distribution for Drupal: Build Advanced Authoring Experiences in Dr...
Lightning Distribution for Drupal: Build Advanced Authoring Experiences in Dr...Lightning Distribution for Drupal: Build Advanced Authoring Experiences in Dr...
Lightning Distribution for Drupal: Build Advanced Authoring Experiences in Dr...Acquia
 
How to Optimize Your Drupal Site with Structured Content
How to Optimize Your Drupal Site with Structured ContentHow to Optimize Your Drupal Site with Structured Content
How to Optimize Your Drupal Site with Structured ContentAcquia
 

Destaque (6)

Successes and Challenges When Managing Large Scale Drupal Projects
Successes and Challenges When Managing Large Scale Drupal ProjectsSuccesses and Challenges When Managing Large Scale Drupal Projects
Successes and Challenges When Managing Large Scale Drupal Projects
 
Speedrun: Build a Website with Panels, Media, and More in 45 Minutes
Speedrun: Build a Website with Panels, Media, and More in 45 MinutesSpeedrun: Build a Website with Panels, Media, and More in 45 Minutes
Speedrun: Build a Website with Panels, Media, and More in 45 Minutes
 
Building a Custom Theme in Drupal 8
Building a Custom Theme in Drupal 8Building a Custom Theme in Drupal 8
Building a Custom Theme in Drupal 8
 
Drupal 8 Quick Start: An Overview of Lightning
Drupal 8 Quick Start: An Overview of LightningDrupal 8 Quick Start: An Overview of Lightning
Drupal 8 Quick Start: An Overview of Lightning
 
Lightning Distribution for Drupal: Build Advanced Authoring Experiences in Dr...
Lightning Distribution for Drupal: Build Advanced Authoring Experiences in Dr...Lightning Distribution for Drupal: Build Advanced Authoring Experiences in Dr...
Lightning Distribution for Drupal: Build Advanced Authoring Experiences in Dr...
 
How to Optimize Your Drupal Site with Structured Content
How to Optimize Your Drupal Site with Structured ContentHow to Optimize Your Drupal Site with Structured Content
How to Optimize Your Drupal Site with Structured Content
 

Semelhante a Entities, Bundles, and Fields: You need to understand this!

Synapse india reviews on drupal 7 entities (stanford)
Synapse india reviews on drupal 7 entities (stanford)Synapse india reviews on drupal 7 entities (stanford)
Synapse india reviews on drupal 7 entities (stanford)Tarunsingh198
 
CORNELL DRUPAL CAMP 2015: One Content Type to Rule Them All
CORNELL DRUPAL CAMP 2015: One Content Type  to Rule Them AllCORNELL DRUPAL CAMP 2015: One Content Type  to Rule Them All
CORNELL DRUPAL CAMP 2015: One Content Type to Rule Them AllWill Jackson
 
ознакомления с модулем Entity api
ознакомления с модулем Entity apiознакомления с модулем Entity api
ознакомления с модулем Entity apiDrupalCamp Kyiv Рысь
 
Fields, entities, lists, oh my!
Fields, entities, lists, oh my!Fields, entities, lists, oh my!
Fields, entities, lists, oh my!Phase2
 
Understanding the Entity API Module
Understanding the Entity API ModuleUnderstanding the Entity API Module
Understanding the Entity API ModuleSergiu Savva
 
Drupal 7 entities & TextbookMadness.com
Drupal 7 entities & TextbookMadness.comDrupal 7 entities & TextbookMadness.com
Drupal 7 entities & TextbookMadness.comJD Leonard
 
Batch Scripting with Drupal (Featuring the EntityFieldQuery API)
Batch Scripting with Drupal (Featuring the EntityFieldQuery API)Batch Scripting with Drupal (Featuring the EntityFieldQuery API)
Batch Scripting with Drupal (Featuring the EntityFieldQuery API)Ranel Padon
 
2.business object repository
2.business object repository2.business object repository
2.business object repositoryAjay Kumar ☁
 
Drupalize your data use entities
Drupalize your data use entitiesDrupalize your data use entities
Drupalize your data use entities均民 戴
 
From CCK to Entities in Drupal: New Power Tools
From CCK to Entities in Drupal: New Power ToolsFrom CCK to Entities in Drupal: New Power Tools
From CCK to Entities in Drupal: New Power ToolsRyan Price
 
one|content : joomla on steroids
one|content : joomla on steroidsone|content : joomla on steroids
one|content : joomla on steroidsPaul Delbar
 
Building nTier Applications with Entity Framework Services (Part 1)
Building nTier Applications with Entity Framework Services (Part 1)Building nTier Applications with Entity Framework Services (Part 1)
Building nTier Applications with Entity Framework Services (Part 1)David McCarter
 
Object Oriented Programming In .Net
Object Oriented Programming In .NetObject Oriented Programming In .Net
Object Oriented Programming In .NetGreg Sohl
 
Entities 101: Understanding Data Structures in Drupal
Entities 101: Understanding Data Structures in DrupalEntities 101: Understanding Data Structures in Drupal
Entities 101: Understanding Data Structures in DrupalAcquia
 
Building nTier Applications with Entity Framework Services (Part 1)
Building nTier Applications with Entity Framework Services (Part 1)Building nTier Applications with Entity Framework Services (Part 1)
Building nTier Applications with Entity Framework Services (Part 1)David McCarter
 
Library management system project
Library management system projectLibrary management system project
Library management system projectAJAY KUMAR
 
Dita for the web: Make Adaptive Content Simple for Writers and Developer
Dita for the web: Make Adaptive Content Simple for Writers and DeveloperDita for the web: Make Adaptive Content Simple for Writers and Developer
Dita for the web: Make Adaptive Content Simple for Writers and DeveloperDon Day
 
Tracking the Tiddlythesaurus
Tracking the TiddlythesaurusTracking the Tiddlythesaurus
Tracking the TiddlythesaurusMichael Adcock
 

Semelhante a Entities, Bundles, and Fields: You need to understand this! (20)

Synapse india reviews on drupal 7 entities (stanford)
Synapse india reviews on drupal 7 entities (stanford)Synapse india reviews on drupal 7 entities (stanford)
Synapse india reviews on drupal 7 entities (stanford)
 
CORNELL DRUPAL CAMP 2015: One Content Type to Rule Them All
CORNELL DRUPAL CAMP 2015: One Content Type  to Rule Them AllCORNELL DRUPAL CAMP 2015: One Content Type  to Rule Them All
CORNELL DRUPAL CAMP 2015: One Content Type to Rule Them All
 
ознакомления с модулем Entity api
ознакомления с модулем Entity apiознакомления с модулем Entity api
ознакомления с модулем Entity api
 
Fields, entities, lists, oh my!
Fields, entities, lists, oh my!Fields, entities, lists, oh my!
Fields, entities, lists, oh my!
 
Understanding the Entity API Module
Understanding the Entity API ModuleUnderstanding the Entity API Module
Understanding the Entity API Module
 
Drupal 7 entities & TextbookMadness.com
Drupal 7 entities & TextbookMadness.comDrupal 7 entities & TextbookMadness.com
Drupal 7 entities & TextbookMadness.com
 
Batch Scripting with Drupal (Featuring the EntityFieldQuery API)
Batch Scripting with Drupal (Featuring the EntityFieldQuery API)Batch Scripting with Drupal (Featuring the EntityFieldQuery API)
Batch Scripting with Drupal (Featuring the EntityFieldQuery API)
 
2.business object repository
2.business object repository2.business object repository
2.business object repository
 
Drupalize your data use entities
Drupalize your data use entitiesDrupalize your data use entities
Drupalize your data use entities
 
From CCK to Entities in Drupal: New Power Tools
From CCK to Entities in Drupal: New Power ToolsFrom CCK to Entities in Drupal: New Power Tools
From CCK to Entities in Drupal: New Power Tools
 
one|content : joomla on steroids
one|content : joomla on steroidsone|content : joomla on steroids
one|content : joomla on steroids
 
Building nTier Applications with Entity Framework Services (Part 1)
Building nTier Applications with Entity Framework Services (Part 1)Building nTier Applications with Entity Framework Services (Part 1)
Building nTier Applications with Entity Framework Services (Part 1)
 
Object Oriented Programming In .Net
Object Oriented Programming In .NetObject Oriented Programming In .Net
Object Oriented Programming In .Net
 
Entities 101: Understanding Data Structures in Drupal
Entities 101: Understanding Data Structures in DrupalEntities 101: Understanding Data Structures in Drupal
Entities 101: Understanding Data Structures in Drupal
 
Form part1
Form part1Form part1
Form part1
 
Building nTier Applications with Entity Framework Services (Part 1)
Building nTier Applications with Entity Framework Services (Part 1)Building nTier Applications with Entity Framework Services (Part 1)
Building nTier Applications with Entity Framework Services (Part 1)
 
Ad507
Ad507Ad507
Ad507
 
Library management system project
Library management system projectLibrary management system project
Library management system project
 
Dita for the web: Make Adaptive Content Simple for Writers and Developer
Dita for the web: Make Adaptive Content Simple for Writers and DeveloperDita for the web: Make Adaptive Content Simple for Writers and Developer
Dita for the web: Make Adaptive Content Simple for Writers and Developer
 
Tracking the Tiddlythesaurus
Tracking the TiddlythesaurusTracking the Tiddlythesaurus
Tracking the Tiddlythesaurus
 

Último

AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024VictoriaMetrics
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...masabamasaba
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in sowetomasabamasaba
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxAnnaArtyushina1
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...masabamasaba
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...masabamasaba
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 

Último (20)

AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 

Entities, Bundles, and Fields: You need to understand this!

  • 1. Entities, Bundles, and Fields Ted Bowman sixmiletech.com
  • 2. TTeedd BBoowwmmaann  tedbow @ drupal.org & twitter  sixmiletech.com  Training and Consulting
  • 3. Entities, Bundles, and Fields Contact Us for: ●Staff Training ●1 on 1 Consulting ●Client Training ●Online Classes
  • 4. Entities, Bundles & Fields  You Need to Understand This!  Why?!?
  • 5. In Drupal you often?  Use Different Entity types  Install modules that create entities  Create new Bundles  Create new Fields  Attach existing Fields to Bundles
  • 6. Drupal let's you know when you.  Use Different Entity types  Install modules that create entities  Create new Bundles  Create new Fields  Attach existing Fields to Bundles
  • 7. Drupal's UI Doesn't Metion  Entity Types  Bundles
  • 8. Entity Types & Bundles  Key concepts about how Drupal Works!  You Need to Learn this
  • 9. Understanding Entity Types & Bundles  Help you choose modules  Help you understand how modules work  Views  Rules  Profile2  Others....
  • 10. What are Entities and Bundles?  Entity Types - core  Nodes  Terms  Users  Comments  Files (non-fieldable)
  • 11. What are Entities and Bundles?  Entity Type - contrib  Profiles – Profile2  Media asset – Media  Commerce Line Item  etc..
  • 12. Drupal 8 Entities  More Core Entities  Configuration Items are (non-fieldable) Entities  Node type  Menu Link  Date format  32+ Entity types in Core  Entities are Classed Objects
  • 13. Entities of same type  Share Properties  All Nodes  Sticky  Published  Changed Date  Created Date  All Comments  Subject  Node ID
  • 14. How to spot an entity type
  • 15. How to spot an entity type
  • 16. Bundles  Most Entity types divided into Bundles
  • 17. What are Entities and Bundles? Bundles  Node -> Article Basic Page
  • 18. What are Entities and Bundles? Bundles  Term -> Keywords Tags
  • 19. What are Entities and Bundles? Bundles  User-> User ?  Some Entity types can only have 1 bundle
  • 20. What are Entities and Bundles?  Bundles  User User  Roles aren't bundles
  • 21. How to spot a bundle
  • 22. How to spot a bundle
  • 23. How to spot a bundle
  • 24. Why haven't I heard of bundles?  Not labeled bundles in Drupal UI  Referred to by different names per Entity type  Nodes = “content type”  Terms = “vocabulary”  Profile2 = “profile type”
  • 27. An Entity  Individual instance of an Entity type  Every Entity belongs to a bundle (even users)  Examples  User:User  admin User 1  Node:Blog Entry  Individual Blog post  Term:Tag  The Tag “awesome“
  • 28. Entity types - SQL Backend  All entities of a type share a “base table”  Not separated by bundle  Table column specifies bundle(if more than 1 bundle)  Easy to query entities of same type but different bundles
  • 29. Entity types - SQL Backend
  • 30. What about Fields?  Entity Types can be fieldable or non-fieldable  Each Bundle can have different fields  All entities of a specific Bundle will have the same fields
  • 31. What about Fields?  Fields can be shared between Entity Types  For example  Field State (field_state)  User:User:field_state  Node:Event:field_state  Profile2:Company:field_state  Not in Drupal 8!  Shared between Bundles within Entity Type
  • 32. Sharing Fields ●Using Views ● CAN DO ● List all nodes by where field_state = FL ● NO CAN DO ● List all nodes and users where field_state = FL ● Because ● Pages, Articles, Webforms, etc – Same table ● Nodes and Users aren't stored in the same table
  • 33. What about Fields?  Examples  Nodes  Article(bundle)  body, tags, image  Basic Page(bundle)  body  Users  User(bundle not seen)  Address Field
  • 34. Field Lingo  Base field  Definition of Field  Field instance  Base field attached to a bundle
  • 35. Field Lingo - Example  Field State (field_state) – Base Field  User:User:field_state – Field Instance  Node:Event:field_state – Field Instance  Profile2:Company:field_state – Field Instance
  • 36. Field Lingo  Creating a New Field  Form #1 – Base Field  Form #2 – Field Instance  Re-using Field  Form #1 – Field Instance
  • 37. Fields – SQL Backend  For all field instances of base field  1 table - Current Data  1 table – Revision Data  For Example  field_data_field_tags  field_revision_field_tags
  • 38. Field – SQL Backend field_data_field_tags
  • 39. Entity API – Drupal 7 Contrib  Entity Helper Functions  Dependency of Many Contrib Entity Modules  Provides Views and Rules Support  Makes life easier for Contrib Maintainers
  • 40. Entities and Views  Views Can  List Entities of different Bundle but same type  Views Can't  List Entities of different Entity types
  • 41. Entities and Rules  Rules Can  React to all Entity Events  Create New Entities  Figure out entity fields and properties
  • 42. Programmer Helpers  EntityFieldQuery  Easily Query Entities  Filter by Field Values  Filter by Properties  EntityMetaData Wrappers  Easily Read and Set fields and properties
  • 43. Modules: New Entities  Profile2  Entityforms  Entity Contruction Kit
  • 44. ●Profile2: Fieldable User Profiles  http://drupal.org/project/profile2  Provides multiple profiles for users  Can restrict Profiles based on Role  Why it's cool!  Kind of like Bundles for users  User entity type has 1 bundle “user“  Let's different roles have different fields  Example  Blogger Profile for fields that pertain only to bloggers
  • 45. ●Profile2: How it works  2 Entity types  Profile Type  Not fieldable  Contains bundle information “bundle of“  Profile  Fieldable
  • 46. ●Profile2: Example  User Joe has a “blogger“ profile  Instance of Profile entity  Bundle = “blogger profile“(profile type)  Fields  How long have you been blogging?(integer field)  Favorite Blog post (entityreference)
  • 47. Profile 2: Why another Entity Type?  Why not use a content type?  Different Properties  No Published status, sticky, etc.  Different behaviors  1 profile per bundle per user(at most)  No comment attached  Seperation for contrib modules  Rules  Views
  • 48. ●Entityforms: Fieldable Forms http://drupal.org/project/entityform  Provides fieldable forms for surveys, polls, etc.  Why it's cool!  Allows use of any Drupal Field in forms  Provides automatic Rules, Views integration  Reduces amount of code needed  I made it!  Example  Create surveys with Geofields
  • 49. ●Entityforms: How it works  2 Entity types  Entityform Type  Not fieldable  Contains bundle information “bundle of“  Entityform (submission)  Fieldable
  • 50. ●Entityform: Example  Customer Survey  Instance of Entityform entity  Bundle = “customer_survey“(Entityform type)  Fields  How was your experience?(Long text)  Employ who helped you (entityreference)
  • 51. Entityforms: Why not Webforms?  Use any Drupal Field  Field Collection, Addressfield, Entityreference  Rules integration  Knows all values of the submissions  Views integration  Knows all values of the submissions  Easy to extend
  • 52. ●Entity Construction Kit: ECK http://drupal.org/project/eck  Create Entity Types and Bundles through the browser  Why it's cool!  Allows creation of new Entity Types without coding  Provides developer framework for creating Entity Types  Example  Employ Entity
  • 53. Does X module provide an Entity type?  Read the Docs!  Docs don't say! What Docs?  Search Files for:  “Implements hook_entity_info().”
  • 54. Making Your Own Entities  Storing data in you own table?  Make it an entity!  Implement hook_entity_info  Thats it! (if you don't want a UI)
  • 55. Modules: New Fields & Entities  Field Collections  Organic Groups  Drupal Commerce
  • 56. ●Field Collections http://drupal.org/project/field_collection  Fields that fieldable Entities  Why it's cool!  Allows bundling Fields together  Like Field Groups but with multiple values and reuse  Example  Reuse a Business Info Field Collection in Entityform Type, Profile2, and Node
  • 57. ●Field Collections: How it works  Entity Type: field_collection_item  Bundle: Each Field Collection Field  Fields attached to bundle
  • 58. Field Collections: Why not use a reference?  Field Collection Item always have a parent entity  Field Collection Items are deleted when parent is deleted  Relationship is built in  Field Collection don't need their own properties
  • 60. Organic Groups  https://drupal.org/project/og  Why it's cool!  User Create-able Groups  Example  Team Content Type
  • 61. Organic Groups  Fields  Provides new Widgets and Behaviors for Existing Field types  Make a Node a Group  Boolean Field  Make Groups content  Entity Reference + OG Reference Widget  Content Visibility  List Field
  • 62. Organic Groups  New Entity Types  Membership Types  Membership  Allows  Different Fields per Membership Type  Rules to react to subscriptions
  • 63. Drupal Commerce  https://drupal.org/project/commerce  Why it's cool!  Everything is an Entity  Super Flexible Commerce System
  • 64. Drupal Commerce  Entity Types  Payment Transaction  Products  Orders  Customer Profile  Line Item  Order
  • 65. Drupal Commerce  Field Types  Line Item Reference  Customer Profile Reference  Price  Etc...
  • 66. Drupal Commerce  Built on Entities and Fields  Drupal Community Benefited  Address Field Module  Inline Entity Form  Etc...
  • 67. Module Selection References vs Entity Reference
  • 68. References Module Provides:  User Reference Fields  Node Reference Fields
  • 69. Entity Reference Module Provides:  Entity Reference Field Works with any Entity Type
  • 70. Winner???? References vs Entity Reference
  • 71. Winner!!!! Entity Reference More Flexible
  • 72. Evaluating Modules  Does module X store new Data Type?  Is Data stored in a new Entity Type?  Is Entity Type Field-able?  Does module x use Entity API? Yes = More Flexible, Less Code, More Integration
  • 73. Evaluating Modules  Does module X attach data to existing Entity Types?  Is data stored in a Field?  Is module Entity agnostic? Yes = More Flexible, More Control, More Integration Maybe less code Performance?
  • 74. Entity Hooks  Provided by Entity API  Other modules can react to/ alter:  Create  Update  Delete  View
  • 75. Entities, Bundles, and Fields Ted Bowman sixmiletech.com @tedbow Questions?