drupal 7 entity api
play

Drupal 7 Entity API Matthew Radcliffe mradcliffe@kosada.com - PowerPoint PPT Presentation

Drupal 7 Entity API Matthew Radcliffe mradcliffe@kosada.com Wednesday, December 7, 2011 Some basic concepts Architecture, engineering, and building Drupal Core and Contrib modules Nodes Wednesday, December 7, 2011 Some basic


  1. Drupal 7 Entity API Matthew Radcliffe mradcliffe@kosada.com Wednesday, December 7, 2011

  2. Some basic concepts • Architecture, engineering, and building • Drupal • Core and Contrib modules • Nodes Wednesday, December 7, 2011

  3. Some basic concepts • Drupal • Core and Contrib modules • Nodes • Content (a post with comments, maybe) • A collection of metadata (i.e. fields). • Contain revisions and access rules about itself. Wednesday, December 7, 2011

  4. All nodes all the time • Ancient History - Why Nodes? • Tired of all the work behind custom schemas. • Drupal 5/6 • Node access • Node forms • CCK (node fields) Wednesday, December 7, 2011

  5. All nodes all the time • Ancient History - Why Nodes? • Tired of all the work behind custom schemas. All nodes of any type are visible • Drupal 5/6 to users with “access content”. • Node access Node access and content access modules are necessary for fine- • Node forms grained control on a node type and per node basis to hide • CCK (node fields) various functionality you need hidden. Wednesday, December 7, 2011

  6. All nodes all the time • Ancient History - Why Nodes? • Tired of all the work behind custom schemas. • Drupal 5/6 • Node access You get everything. Hiding interfaces that aren’t necessary • Node forms in your use case is a non-trivial amount of time. • Everything is a node Wednesday, December 7, 2011

  7. All nodes all the time • Ancient History - Why Nodes? • Tired of all the work behind custom schemas. • Drupal 5/6 • Node access Nodes are robust pieces of content able to handle • Node forms comments, revisions, fields, etc... • Everything is a node Wednesday, December 7, 2011

  8. All nodes all the time • Ancient History - Why Nodes? • Tired of all the work behind custom schemas. • Drupal 5/6 • Node access • Node forms • CCK (node fields) • Drupal 7: Entities! Wednesday, December 7, 2011

  9. What is an entity? • An entity is an abstract object. • node, taxonomy, comment, user. • An entity type may do all of what a node did in Drupal 5 and Drupal 6. • Revisions • Fields • Bundles • Access, URI, Theming, View Modes Wednesday, December 7, 2011

  10. What is an entity? • An entity is an abstract object. • node, taxonomy, comment, user. Entity controller classes can have public methods such as • An entity type may do all of what a node did in load() and delete(). Drupal 5 and Drupal 6. Additionally, most entities define global methods using • Revisions their standard Drupal namespace (module name) to allow other modules to use something not-object based: • Fields node_save(), node_load(). • Bundles • Access, URI, Theming, View Modes Wednesday, December 7, 2011

  11. What is an entity? • An entity is an abstract object. • node, taxonomy, comment, user. • An entity type may do all of what a node did in Drupal 5 and Drupal 6. You can define your own revision • Revisions table for your custom entity, which you would need to save data in as • Fields well when you call your entity’s save method. • Bundles • Access, URI, Theming, View Modes Wednesday, December 7, 2011

  12. What is an entity? • An entity is an abstract object. • node, taxonomy, comment, user. • An entity type may do all of what a node did in Drupal 5 and Drupal 6. The Drupal 5 and 6 concept of • Revisions “CCK” or custom fields was pushed into Drupal core, which means that • Fields all entities may contain fields. • Bundles Good bye, Content Profile. Hello, Profile2! • Access, URI, Theming, View Modes Wednesday, December 7, 2011

  13. What is an entity? • An entity is an abstract object. • node, taxonomy, comment, user. • An entity type may do all of what a node did in Drupal 5 and Drupal 6. • Revisions Entities may have an associated “bundle” or type like the Drupal • Fields node type, but some entities may not want to allow types like the • Bundles user entity. • Access, URI, Theming, View Modes Wednesday, December 7, 2011

  14. What is an entity? • An entity is an abstract object. • node, taxonomy, comment, user. • An entity type may do all of what a node did in Drupal 5 and Drupal 6. And yet it’s still a pain... • Revisions • Fields • Bundles • Access, URI, Theming, View Modes Wednesday, December 7, 2011

  15. Entity API • http://drupal.org/project/entity • EntityAPIController • EntityAPIControllerExportable • EntityTypeUIController • Entity Properties • Examples: Profile2, Organic Groups, Commerce, Media Wednesday, December 7, 2011

  16. Entity API • http://drupal.org/project/entity • EntityAPIController Better public methods • EntityAPIControllerExportable • EntityTypeUIController • Entity Properties • Examples: Profile2, Organic Groups, Commerce, Media Wednesday, December 7, 2011

  17. Entity API • http://drupal.org/project/entity • EntityAPIController • EntityAPIControllerExportable Exportable bundles (features!) • EntityTypeUIController • Entity Properties • Examples: Profile2, Organic Groups, Commerce, Media Wednesday, December 7, 2011

  18. Entity API • http://drupal.org/project/entity • EntityAPIController • EntityAPIControllerExportable • EntityTypeUIController Clone, Delete admin ui for free • Entity Properties • Examples: Profile2, Organic Groups, Commerce, Media Wednesday, December 7, 2011

  19. Entity API • http://drupal.org/project/entity • EntityAPIController • EntityAPIControllerExportable • EntityTypeUIController Clone, Delete admin ui for free • Entity Properties • Examples: Profile2, Organic Groups, Commerce, Media Wednesday, December 7, 2011

  20. Entity API • http://drupal.org/project/entity • EntityAPIController • EntityAPIControllerExportable • EntityTypeUIController Clone, Delete admin ui for free • Entity Properties • Examples: Profile2, Organic Groups, Commerce, Media Wednesday, December 7, 2011

  21. Entity API • http://drupal.org/project/entity • EntityAPIController • EntityAPIControllerExportable • EntityTypeUIController • Entity Properties Views and Rules support for free • Examples: Profile2, Organic Groups, Commerce, Media Wednesday, December 7, 2011

  22. Entity API • http://drupal.org/project/entity • EntityAPIController • EntityAPIControllerExportable • EntityTypeUIController • Entity Properties Views and Rules support for free • Examples: Profile2, Organic Groups, Commerce, Media Wednesday, December 7, 2011

  23. Entity API • http://drupal.org/project/entity • EntityAPIController • EntityAPIControllerExportable • EntityTypeUIController • Entity Properties Views and Rules support for free • Examples: Profile2, Organic Groups, Commerce, Media Wednesday, December 7, 2011

  24. Drupal Site Architecture • Entities will change how you architect, engineer, and build Drupal web sites. • Architect - plan flexible and unique data types. • Engineer - develop re-usable code. • Builder - utilize the tools that Entity API and the developer provides to make quick changes to Views, Rules, Themes, etc... Wednesday, December 7, 2011

  25. Questions / Example • Example - Show me the code! • Questions? • Views API • Drush • Rules • Field / Field Attach API Wednesday, December 7, 2011

Recommend


More recommend