Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
USING FEATURES        Badiu Alexandru   So you’ll have more free time too       Drupalcamp Bucharest 2011
MIGHT HAVEHAPPENED TO YOU• The dev – staging – production issue• You build the site• Client wants new stuff• You build it ...
MIGHT HAVEHAPPENED TO YOU• The “I’ve done this before” issue• You build some feature for client A• Along comes client B wh...
MIGHT HAVEHAPPENED TO YOU• The “Is there anyone editing file x.module?”  issue• You work on a large project• Each dev pushe...
MIGHT HAVEHAPPENED TO YOU• The “What the f**k do I do now?” issue• Drupal is hard for beginners• Lots of modules• Building...
DO YOU SEE A       PATTERN?• Wouldn’t it be nice if you had a repository of  “modules” that create functionality a little ...
DO YOU SEE A       PATTERN??• Wouldn’t it be nice if you could avoid all the  manual exporting and importing of new  featu...
DO YOU SEE A       PATTERN?• Made some code or db changes?• Just click to generate a new version of the  “module“• Check i...
SO WHAT IS THE      PROBLEM?• This is not necessarily a Drupal only  problem• It’s the nature of web development and the  ...
SO WHAT IS THE   PROBLEM?   Drupalcamp Bucharest 2011
EXPORTAB• Exportables are ways of, well, exporting  things from Drupal into code bits• Pioneered by Views, CCK is also usi...
MODULAR• It can also help if your site functionality is  broken into a modular design• Like maybe prefixing presets and vie...
MODULAR• What about blocks?• Block visibility: php code or list of pages? Both?  Complex conditions?• What about menus?• I...
CONTEXT•   Built by Development Seed•   You create sections for your site•   They are triggered by various conditions•   T...
ALMOST• We can organize “visual” bits and pieces of  our site using contexts• We can use the same organization to name  th...
FEATURES• The Features module does exactly that• It takes different clues as to what you want  to package• There’s the man...
FEATURES• The module contains all the necessary bits and  pieces about your views, content types, presets  etc• Contains c...
FEATURES• It doesn’t use update functions• But you can write your own• Doesn’t script site building, uses  exportables• Th...
FEATURES•   Context, Spaces, Boxes, Strongarm, Page    Manager (CTools)•   ImageCache•   Views•   http://drupal.org/taxono...
YOUR•   You have two options to integrate•   CTools Export API (recommended)•   Features hooks•   Before that you might ha...
SHARE• A feature can be installed on any other site  that has the required modules• You can put it on d.org• Features serv...
BASIC• Simple demo   We are going to build a blog feature   Use a context to “group” it   Create a content type for it ...
BASIC•   We’re going to use BuildKit•   Drupal install profile with Features•   drush make "http://drupalcode.org/    proje...
ADVANCE• The next step: the Spaces module• Again, Development Seed• Makes a Drupal site act like multiple sites• Makes fea...
RESOURCE• http://drupal.org/project/features• http://drupal.org/project/buildkit• http://drupal.org/project/kit• http://dr...
THANK   andu@ctrlz.ro   http://ctrlz.roDrupalcamp Bucharest 2011
Upcoming SlideShare
Loading in …5
×

Using Features

2,068 views

Published on

Talk given at Drupalcamp Bucharest 2011.

Published in: Technology
  • Be the first to comment

Using Features

  1. 1. USING FEATURES Badiu Alexandru So you’ll have more free time too Drupalcamp Bucharest 2011
  2. 2. MIGHT HAVEHAPPENED TO YOU• The dev – staging – production issue• You build the site• Client wants new stuff• You build it on dev, passes staging• Replicate on live site• Write update functions, manual exporting of views, cck Drupalcamp Bucharest 2011
  3. 3. MIGHT HAVEHAPPENED TO YOU• The “I’ve done this before” issue• You build some feature for client A• Along comes client B who wants the same thing• Take code, exported views, cck, push to dev• Work• Replicate on prod Drupalcamp Bucharest 2011
  4. 4. MIGHT HAVEHAPPENED TO YOU• The “Is there anyone editing file x.module?” issue• You work on a large project• Each dev pushes code to a repository or no repo at all• What about database changes?• Export views, cck and push them as well• Make sure each dev imports stuff after each update Drupalcamp Bucharest 2011
  5. 5. MIGHT HAVEHAPPENED TO YOU• The “What the f**k do I do now?” issue• Drupal is hard for beginners• Lots of modules• Building a feature requires multiple modules usually and some knowledge about them• Drupal recipes are good Drupalcamp Bucharest 2011
  6. 6. DO YOU SEE A PATTERN?• Wouldn’t it be nice if you had a repository of “modules” that create functionality a little bit more than “list all blog posts” or “have a block with latest promoted posts in category A”?• Learn the open source way• Instant gratification• Uuuu, this is cool Drupalcamp Bucharest 2011
  7. 7. DO YOU SEE A PATTERN??• Wouldn’t it be nice if you could avoid all the manual exporting and importing of new features / changes and just package functionality in a “module” that can be updated?• Modules are code, code can be put into versioning control (and you should do it)• Database changes can’t (easily) Drupalcamp Bucharest 2011
  8. 8. DO YOU SEE A PATTERN?• Made some code or db changes?• Just click to generate a new version of the “module“• Check in, others check out, update is done• Less wrinkles and teeth grinding Drupalcamp Bucharest 2011
  9. 9. SO WHAT IS THE PROBLEM?• This is not necessarily a Drupal only problem• It’s the nature of web development and the way we do it• Coding != Site building• If only products of site building could be exported…• Oh wait Drupalcamp Bucharest 2011
  10. 10. SO WHAT IS THE PROBLEM? Drupalcamp Bucharest 2011
  11. 11. EXPORTAB• Exportables are ways of, well, exporting things from Drupal into code bits• Pioneered by Views, CCK is also using this• Imagecache, Spaces, Context, Strongarm• Is this enough?• No, replication is still a… not a piece of cake• Lots of missing modules (like taxonomy) Drupalcamp Bucharest 2011
  12. 12. MODULAR• It can also help if your site functionality is broken into a modular design• Like maybe prefixing presets and views with blog_ or joblistings_• Or use image_blog_medium rather than image_blog_300x50• Or have site_blog.module and site_listings.module rather than that gigantic site.module• These are nice first steps Drupalcamp Bucharest 2011
  13. 13. MODULAR• What about blocks?• Block visibility: php code or list of pages? Both? Complex conditions?• What about menus?• I want this menu to appear when you’re on a blog post but I want this other menu to appear on listings.• Sitewide conditions: this should appear only if none of the conditions for the other “sections” are met Drupalcamp Bucharest 2011
  14. 14. CONTEXT• Built by Development Seed• You create sections for your site• They are triggered by various conditions• They enable blocks, activate menus• They can be global• They can act as failbacks• They stack• http://drupal.org/project/context Drupalcamp Bucharest 2011
  15. 15. ALMOST• We can organize “visual” bits and pieces of our site using contexts• We can use the same organization to name the products of our various site building tools• We can follow a modular approach when developing our modules• If only we could package all these changes into a module. Drupalcamp Bucharest 2011
  16. 16. FEATURES• The Features module does exactly that• It takes different clues as to what you want to package• There’s the manual way too (it’s not perfect)• It exports automatically whatever it can (not all modules use exportables)• It adds it’s magic• Generates a “feature” which is actually a module Drupalcamp Bucharest 2011
  17. 17. FEATURES• The module contains all the necessary bits and pieces about your views, content types, presets etc• Contains code to activate them (create or update them) and deactivate them• Knows about dependencies so it won’t break the site• It’s a module so you can hack away• Once you add more stuff: click click => new version of the module Drupalcamp Bucharest 2011
  18. 18. FEATURES• It doesn’t use update functions• But you can write your own• Doesn’t script site building, uses exportables• This means that not all modules work• Menu and Taxonomy have issues• Webform creates actual nodes• Feed nodes, ToS and Privacy Policy pages• UUID for content Drupalcamp Bucharest 2011
  19. 19. FEATURES• Context, Spaces, Boxes, Strongarm, Page Manager (CTools)• ImageCache• Views• http://drupal.org/taxonomy/term/11478• CCK, Content types, Input filters, Permissions Drupalcamp Bucharest 2011
  20. 20. YOUR• You have two options to integrate• CTools Export API (recommended)• Features hooks• Before that you might have to prepare Drupalcamp Bucharest 2011
  21. 21. SHARE• A feature can be installed on any other site that has the required modules• You can put it on d.org• Features server: repository of features• Internal or external• Get notified of updates• List of repos: http://groups.drupal.org/ node/50278 Drupalcamp Bucharest 2011
  22. 22. BASIC• Simple demo  We are going to build a blog feature  Use a context to “group” it  Create a content type for it  Make it use a vocabulary  Create a listing and a block using views  Package it using Features  Deploy it on another site Drupalcamp Bucharest 2011
  23. 23. BASIC• We’re going to use BuildKit• Drupal install profile with Features• drush make "http://drupalcode.org/ project/buildkit.git/blob_plain/refs/ tags/7.x-2.0-beta2:/distro.make" sitedir Drupalcamp Bucharest 2011
  24. 24. ADVANCE• The next step: the Spaces module• Again, Development Seed• Makes a Drupal site act like multiple sites• Makes features spaces aware: selective enabling of features on a per group basis Drupalcamp Bucharest 2011
  25. 25. RESOURCE• http://drupal.org/project/features• http://drupal.org/project/buildkit• http://drupal.org/project/kit• http://drupal.org/project/context• http://drupal.org/project/spaces• http://drupal.org/project/uuid_features• http://groups.drupal.org/packaging- deployment• http://developmentseed.org/tags/features Drupalcamp Bucharest 2011
  26. 26. THANK andu@ctrlz.ro http://ctrlz.roDrupalcamp Bucharest 2011

×