D7 Entities

  • 1,182 views
Uploaded on

Drupal 7 Entities was delivered by Tomi Mikola of Mearra

Drupal 7 Entities was delivered by Tomi Mikola of Mearra

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
1,182
On Slideshare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
17
Comments
0
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Drupal 7 Entities DrupalCamp Helsinki 27.9.2011 Tomi Mikolabusiness of open technology
  • 2. About me • Working at Mearra • Architect, senior developer, project mgr, salesman, co-founder, Drupal evangelist • Drupal as the primary platform since 2006business of open technology
  • 3. What are entities?business of open technology
  • 4. Concept of Entity • Generalization of something that can be stored in Drupal • Standardized set of how data structures are represented • In D6 nodes were considered as the main abstraction pointbusiness of open technology
  • 5. Concept of Entity • Type of objects which Drupal is aware of • Something unique, relevant to the application • "The new Node" • D7: Nodes, Users, Files, Comments, Terms, ...business of open technology
  • 6. Fields and entitiesbusiness of open technology
  • 7. Fields • Data types which can be attached to any kind of entity • Widgets & formatters • Field instancesbusiness of open technology
  • 8. Bundles • Entity + field (*n) = Bundle • Node (entity), Article (bundle) • User (entity), User (bundle)business of open technology
  • 9. business of open technology Entity API
  • 10. Entity API • Contrib module (drupal.org/project/entity) • Completes what Drupal core entities should be • Full CRUD operationsbusiness of open technology
  • 11. business of open technology Entity?
  • 12. Entities or Nodes? • “I created a draft using Word” • Translations, versioning? • End-user’s point of view: “Content!”business of open technology
  • 13. How to begin?business of open technology
  • 14. How to begin with entities? • No UI • Write code • hook_schema() • hook_entity_info() • Label • Base table • Fieldablebusiness of open technology
  • 15. How to begin with entities? function node_entity_info() { $return = array( node => array( label => t(Node), controller class => NodeController, base table => node, revision table => node_revision, uri callback => node_uri, fieldable => TRUE, entity keys => array( id => nid, revision => vid, bundle => type, label => title, ), bundles => array(), //...business of open technology
  • 16. business of open technology Prove it!
  • 17. Poll Improved (demo) • Drupal core Poll doesn’t take advantage of entities • Started new project to test Entity API • Model (contrib module) as basis • Flexibility by using Field APIbusiness of open technology
  • 18. Thank you!business of open technology
  • 19. business of open technology Photos © Tomi Mikola