Your SlideShare is downloading. ×
0
Features,
Exportables & You


Jon Skulski
Drupal Architect, ChapterThree LLC
jon@chapterthree.com
http://www.chapterthree....
Features
        http://www.drupal.org/project/features



•   by Development Seed

•   organize Components
    into Featu...
Features
               what makes a feature, mr. lebowski?

•   views

•   panels

•   content types

•   drupal variable...
Blog
                 a typical Drupal use case



•   a Content Type to save
    the data. blog_entry

•   a View to disp...
DEMO
see it in action
State of the Union
what works in features, what needs work
Works Wonderfully
    extensive use and little to no problems




• Views
• :-
Works OK
     known problems, known workarounds

• CCK/Content Types
 • basic use case is solid.
 • #693944 - field weighti...
Works OK
     known problems, known workarounds



• Panels/Page Manager/CTools
 • basic use case is solid.
 • #740074 - m...
Works OK
     known problems, known workarounds




• Variables / Strongarm
 • basic use case is solid.
 • nothing specific...
Works OK
     known problems, known workarounds




• drush features-update
 • using drush has sometimes failed to
    inc...
Broken :-(
  known problems, unknown workarounds



• Dependencies
 • basic use case is solid.
 • #649604 adding new depen...
Broken :-(
  known problems, unknown workarounds




• Taxonomy
 • no default hook
Broken :-(
  known problems, unknown workarounds



• Anything without a Default Hook
 • A default hook is a pattern in dr...
Exportables
      http://www.drupal.org/project/exportables


•   by jazzslider & dmitrig01

•   provides an API for
    a...
Exportables
       never send a human to do a machine’s job


•   allows an exportable to give a machine name to the
    n...
Exportables
       never send a human to do a machine’s job


•   hook_exportables allows us to define the default, load, s...
Exportables
never send a human to do a machine’s job

       So we can use this export
             taxonomies!
Exportables
never send a human to do a machine’s job




               Well, no.
Exportables
never send a human to do a machine’s job
Exportables
        never send a human to do a machine’s job




Taxonomies use sequential IDs and exportables allow
   us...
Exportables
never send a human to do a machine’s job


   Views filters in code look like:
Exportables
never send a human to do a machine’s job


     Which translates into this:
Exportables
         never send a human to do a machine’s job




 So what happens when you push a new feature and it
inst...
Exportables
never send a human to do a machine’s job
Case Study:
    Reserved Taxonomy
•   Reserved Taxonomy solves this problem by giving developers an
    exportable with fe...
CODE
see it in motion
Questions?
Comments? Experiences?
Thanks!


Jon Skulski
Drupal Architect, ChapterThree LLC
jon@chapterthree.com / jonskulski
Upcoming SlideShare
Loading in...5
×

Features, Exportables & You

2,429

Published on

My sldies from a talk including an intro to features, exportables, issues with features, state of features and how to implmenet the exportable and feature API

Published in: Technology
1 Comment
3 Likes
Statistics
Notes
No Downloads
Views
Total Views
2,429
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
28
Comments
1
Likes
3
Embeds 0
No embeds

No notes for slide





























  • Transcript of "Features, Exportables & You"

    1. 1. Features, Exportables & You Jon Skulski Drupal Architect, ChapterThree LLC jon@chapterthree.com http://www.chapterthree.com/blog/jon_skulski
    2. 2. Features http://www.drupal.org/project/features • by Development Seed • organize Components into Features • export DB Site Configuration to Code
    3. 3. Features what makes a feature, mr. lebowski? • views • panels • content types • drupal variables (strongarm) • contexts • spaces • menu items • imagecache presets • your custom code (it is a module)
    4. 4. Blog a typical Drupal use case • a Content Type to save the data. blog_entry • a View to display the blog entries. blog • a Panel Variant to display the node. node_view
    5. 5. DEMO see it in action
    6. 6. State of the Union what works in features, what needs work
    7. 7. Works Wonderfully extensive use and little to no problems • Views • :-
    8. 8. Works OK known problems, known workarounds • CCK/Content Types • basic use case is solid. • #693944 - field weighting of non-CCK fields is suspect. use form_alter. • #649298 - field removal doesn’t work. use hook_update. • #480978 - fieldsets need manual feature revert. so do it.
    9. 9. Works OK known problems, known workarounds • Panels/Page Manager/CTools • basic use case is solid. • #740074 - multiple (i.e. node view) variants across separate features is broken. manually change the page manager handler name.
    10. 10. Works OK known problems, known workarounds • Variables / Strongarm • basic use case is solid. • nothing specific, just suspect. sometimes it seems like variables don’t get included. Be careful and check your work.
    11. 11. Works OK known problems, known workarounds • drush features-update • using drush has sometimes failed to include new files in the feature. use the download button in admin/build/features.
    12. 12. Broken :-( known problems, unknown workarounds • Dependencies • basic use case is solid. • #649604 adding new dependencies leads to a race condition. use hook_update & drupal_install_modules() to enforce a dependencies.
    13. 13. Broken :-( known problems, unknown workarounds • Taxonomy • no default hook
    14. 14. Broken :-( known problems, unknown workarounds • Anything without a Default Hook • A default hook is a pattern in drupal that allows code to add objects like views, content types, etc. • By design, features uses default hooks. So anything without one isn’t going to work. Use exportables...
    15. 15. Exportables http://www.drupal.org/project/exportables • by jazzslider & dmitrig01 • provides an API for adding Default Hook-ish Functionality • allows DB Site Configuration to be exported to Code
    16. 16. Exportables never send a human to do a machine’s job • allows an exportable to give a machine name to the nameless • maintains a link between the sequential ID and the declared machine name • pays attention to changes in the database versus our default code • pretty good at caching the right stuff
    17. 17. Exportables never send a human to do a machine’s job • hook_exportables allows us to define the default, load, save, delete functions our exportable will use • exportables_sync uses the default, load and save functions to add our exportable to the database • exportables_unsync uses the delete function to remove our exportable from the database • i’ll get to a real example in a minute...
    18. 18. Exportables never send a human to do a machine’s job So we can use this export taxonomies!
    19. 19. Exportables never send a human to do a machine’s job Well, no.
    20. 20. Exportables never send a human to do a machine’s job
    21. 21. Exportables never send a human to do a machine’s job Taxonomies use sequential IDs and exportables allow us to link that to a machine name. So what’s the problem?
    22. 22. Exportables never send a human to do a machine’s job Views filters in code look like:
    23. 23. Exportables never send a human to do a machine’s job Which translates into this:
    24. 24. Exportables never send a human to do a machine’s job So what happens when you push a new feature and it installs the vocabulary at VID = 18 because a client had created new vocabularies?
    25. 25. Exportables never send a human to do a machine’s job
    26. 26. Case Study: Reserved Taxonomy • Reserved Taxonomy solves this problem by giving developers an exportable with feature integration to install vocabularies and terms at specific vocabulary IDs and term IDs • The idea is that you set aside a block of IDs for your terms and vocabularies. More than you will ever need. Say, 1-100000. Then any terms that the clients or you add later will start at 1000001. • That way if you need to add more later, you can without conflicts.
    27. 27. CODE see it in motion
    28. 28. Questions? Comments? Experiences?
    29. 29. Thanks! Jon Skulski Drupal Architect, ChapterThree LLC jon@chapterthree.com / jonskulski
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×