SlideShare a Scribd company logo
1 of 30
Download to read offline
THE LEADER IN DRUPAL PLATFORM DESIGN AND DEVELOPMENT




Tuesday, July 31, 12
BUILDING AND DEPLOYING
              SITES USING FEATURES

Tuesday, July 31, 12
BUILDING AND DEPLOYING SITES USING FEATURES
        • Mike Potter
          Phase2 Technology
        • Maintainer of Features and
          Features Override modules
        • mpotter on Drupal.org
        • #drupal-features IRC channel




Tuesday, July 31, 12
DRUPAL ARCHITECTURE
                         Web Server
                 Web                       Database
               Browser                     Content
                           File System     Configuration

                              Code
                            Configuration


                          FEATURES

Tuesday, July 31, 12
FEATURES
        • Brings configuration from the Database into Code.
                                     (called an exportable)

        • A Feature is a Drupal Module.
        • The Features Module provides a User Interface for
          manipulating features.




Tuesday, July 31, 12
WHY?
           • Separates Site configuration from Site content.
           • Encapsulates functionality into a package that can
             be used on multiple sites.
           • Allows version control (track changes, revert, etc).
           • Easier deployment.
           • Saves development time!!




Tuesday, July 31, 12
EXPORTABLE TYPES
         • Content Types, Fields, Menus, Taxonomies, Text
           formats, Image styles, User roles and
           permissions, Views, CTools, Context   CORE
         • System variables (Strongarm)
         • Node queues, Boxes (blocks), Nodes (content),
           Panels, Commerce products, many more.
         • Any module can support exporting as Feature.




Tuesday, July 31, 12
USAGE CASES
          • Bundle some functionality into a Feature
            e.g. Photo Gallery
            contains Content Type, Fields, Views

          • Deploy configuration data using a Feature
            e.g. Transfer user permissions from
            Dev server to Production.




Tuesday, July 31, 12
DEMO TIME !




Tuesday, July 31, 12
/admin/structure/features/create

        MAKE A
        NEW
        FEATURE




Tuesday, July 31, 12
FEATURE IS A MODULE
                • Downloading a Feature creates .tar package
                • Install just like any normal module
                • Enable the module                /sites/all/modules/features




Tuesday, July 31, 12
IT’S ALL IN THE CODE!                                                           the “default hook”


                               cats.info                                       cats.features.inc
                                name = Cats                                     /**
                                description = Description of Cats feature         * Implements hook_node_info().
                                core = 7.x                                        */
                                package = Cat Package                           function cats_node_info() {
                                php = 5.2.4                                        $items = array(
                                dependencies[] = features                             'cat' => array(
                                dependencies[] = image                                   'name' => t('Cat'),
                                dependencies[] = link                                    'base' => 'node_content',
                                dependencies[] = node_reference                          'description' => '',
                                eatures[features_api][] = api:1                          'has_title' => '1',
                                features[field][] = node-cat-body                        'title_label' => t('Name'),
                                features[field][] = node-cat-field_age                   'help' => '',
                                features[field][] = node-cat-field_cat_image          ),
                                features[field][] = node-cat-field_test_link       );
                                features[field][] = node-cat-field_test_ref        return $items;
                                features[node][] = cat                          }




               Features will keep your changes to *.module and any other files you add




Tuesday, July 31, 12
IT’S ALL (MOSTLY) IN THE CODE!
         • “Pure” Exportables          • “Faux” exportables
           - all in code                 - some code
           - nothing in DB               - some config in DB

         • Views, CTools, etc          • Fields

                uses existing module     requires Features
                hooks

                don’t need Features




Tuesday, July 31, 12
UPDATING A FEATURE
         • Make a manual change to   • “Recreate” the feature to
           the database                add new data to code
           configuration                         or
                                     • “Revert” the feature to
         • Feature exportable is       restore original config
           marked as “Overridden”




                          click



Tuesday, July 31, 12
REVERT VS RECREATE
                                      Revert
                                                 Database
                       Code on disk

                                      Recreate




Tuesday, July 31, 12
USING DRUSH WITH FEATURES
            • If anybody doesn’t know about Drush
              then time for a quick DEMO!
                                                                         drupal.org/projects/drush
       All commands in features: (features)
        features-add (fa)     Add a component to a feature module.
        features-diff (fd)    Show the difference between the default and overridden state of a feature.
        features-export (fe) Export a feature from your site into a module.
        features-list (fl,    List all the available features for your site.
        features)
        features-revert (fr) Revert a feature module on your site.
        features-revert-all   Revert all enabled feature module on your site.
        (fr-all, fra)
        features-update (fu) Update a feature module on your site.
        features-update-all   Update all feature modules on your site.
        (fu-all, fua)




Tuesday, July 31, 12
REVERTING FEATURES USING DRUSH
        $ drush        fl
         Name                    Feature          Status     State
         Distro        Article   distro_article   Enabled
         Distro        User      distro_user      Disabled
         Distro        View      distro_view      Enabled    Overridden


        $ drush fd distro_view
        Legend:
        Code:       drush features-revert will remove the overrides.      RED is Code
        Overrides: drush features-update will update the exported feature with the displayed overrides


        Component: views_view
                                                                          GREEN is Database
            /* Display: Master */
            $handler = $view->new_display('default', 'Master', 'default');
        <   $handler->display->display_options['title'] = 'My Cat List';
        ---
        >   $handler->display->display_options['title'] = 'My Cat List New';
            $handler->display->display_options['access']['type'] = 'perm';
            $handler->display->display_options['cache']['type'] = 'none';




Tuesday, July 31, 12
REVERTING FEATURES USING DRUSH - 2
         Keep RED Code (Code Database)
         $ drush fr distro_view
         Do you really want to revert views_view? (y/n): y
         Reverted views_view.




        Keep GREEN Database (Database Code)
         $ drush fu distro_view
         Module appears to already exist in sites/all/modules/features/distro_view
         Do you really want to continue? (y/n): y
         Created module: distro_view in sites/all/modules/features/distro_view




Tuesday, July 31, 12
DEBUGGING OVERRIDDEN FEATURES
       When Reverting fails to remove Overridden

         • Use “drush fd” to see what is different

         • Make sure difference isn’t provided by a
           disabled module.

         • If a View, try Reverting from the Views UI

         • Last resort: try editing code manually, or making
           database change manually to match code.



Tuesday, July 31, 12
FEATURES SERVER         drupal.org/project/fserver


            • Allows features to be shared, distributed and
              updated.
            • No longer in wide use because of alternatives:
              drupal.org sandboxes, github, and Apps




Tuesday, July 31, 12
APPS        drupal.org/project/apps

         • An App is a Feature(s) along with a manifest that
           allows it to be distributed via an App Server.
         • An App is a clean, polished, modular piece of
           functionality.
         • Apps are currently used mostly by Distributions to
           supply optional functionality.




Tuesday, July 31, 12
OVERRIDES
           • Using a Feature that you don’t want to change?
                   (e.g. comes from a base Distribution like OpenPublish)

           • Client made site-specific configuration changes?
           • Capture those changes into a NEW feature
                        called an “Override”




Tuesday, July 31, 12
FEATURES OVERRIDE MODULE
     • Rewritten for D7 to be easier to use
     • Generates simple code for overrides
     • Allows line-level inspection of overrides
     • Uses existing “alter” hooks
                drupal_alter(‘default_hook’, $data);
                                                                      Called by Drupal
                function override_feature_views_default_views_alter(&$data) {
                  if (isset($data['cat_fields'])) {
                    $data['cat_fields']->display['default']->display_options['title'] = 'New Cat View title'; /* WAS: 'My Cat List' */
                  }
                }


                                 Code in Override feature




Tuesday, July 31, 12
FEATURES OVERRIDE DEMO


                            I can’t look!




Tuesday, July 31, 12
EXTRA DOUBLE-SECRET PROBATION DEMO
         • Change a View
         • Add a field to a View
         • Remove a field from a
           View
         • All in ONE Override!




Tuesday, July 31, 12
INSPECTING OVERRIDES
       • Old method (Review Overrides using diff module)




Tuesday, July 31, 12
INSPECTING OVERRIDES
   • New method (Overrides using Features Override)




Tuesday, July 31, 12
WHAT DOES THIS ALL MEAN? (CASE 1)
       • Use a Distribution containing features.
       • Customize site for specific Client needs.
       • Capture changes to a Features Override.
       • New version of Distribution released?
             • Just install new features
             • Site-specific changes are maintained in Override.




Tuesday, July 31, 12
WHAT DOES THIS ALL MEAN? (CASE 2)
     • Build site for client using Features.
     • Deploy from your Dev server to Staging.
     • Deploy from Staging to Production.
     • Client makes emergency changes to live Production.
     • Capture those changes into Features Override
           • Keep separate or roll back into Dev features




Tuesday, July 31, 12
BOTTOM LINE
      • Use Features. They will save you.
      • Use Overrides. They will make you a star!


                       QUESTIONS?
                       #drupal-features
            mpotter@phase2technology.com




Tuesday, July 31, 12

More Related Content

What's hot

Moose Design Patterns
Moose Design PatternsMoose Design Patterns
Moose Design PatternsYnon Perek
 
The Solar Framework for PHP
The Solar Framework for PHPThe Solar Framework for PHP
The Solar Framework for PHPConFoo
 
13 gui development
13 gui development13 gui development
13 gui developmentAPU
 
Puppet Design Patterns - PuppetConf
Puppet Design Patterns - PuppetConfPuppet Design Patterns - PuppetConf
Puppet Design Patterns - PuppetConfDavid Danzilio
 
Director x Backbone = :)
Director x Backbone = :)Director x Backbone = :)
Director x Backbone = :)Janessa Det
 
12 global fetching strategies
12 global fetching strategies12 global fetching strategies
12 global fetching strategiesthirumuru2012
 

What's hot (10)

Bean Intro
Bean IntroBean Intro
Bean Intro
 
Puppet quick start guide
Puppet quick start guidePuppet quick start guide
Puppet quick start guide
 
Moose Design Patterns
Moose Design PatternsMoose Design Patterns
Moose Design Patterns
 
The Solar Framework for PHP
The Solar Framework for PHPThe Solar Framework for PHP
The Solar Framework for PHP
 
Back2 Basic Tools
Back2 Basic ToolsBack2 Basic Tools
Back2 Basic Tools
 
13 gui development
13 gui development13 gui development
13 gui development
 
Puppet Design Patterns - PuppetConf
Puppet Design Patterns - PuppetConfPuppet Design Patterns - PuppetConf
Puppet Design Patterns - PuppetConf
 
Unit iv
Unit ivUnit iv
Unit iv
 
Director x Backbone = :)
Director x Backbone = :)Director x Backbone = :)
Director x Backbone = :)
 
12 global fetching strategies
12 global fetching strategies12 global fetching strategies
12 global fetching strategies
 

Similar to CapitalCamp Features

Intro to Features Module on Drupal
Intro to Features Module on DrupalIntro to Features Module on Drupal
Intro to Features Module on DrupalAidan Foster
 
Staying Sane with Drupal (A Develper's Survival Guide)
Staying Sane with Drupal (A Develper's Survival Guide)Staying Sane with Drupal (A Develper's Survival Guide)
Staying Sane with Drupal (A Develper's Survival Guide)Oscar Merida
 
Building and Maintaining a Distribution in Drupal 7 with Features
Building and Maintaining a  Distribution in Drupal 7 with FeaturesBuilding and Maintaining a  Distribution in Drupal 7 with Features
Building and Maintaining a Distribution in Drupal 7 with FeaturesNuvole
 
Strategies for Puppet code upgrade and refactoring
Strategies for Puppet code upgrade and refactoringStrategies for Puppet code upgrade and refactoring
Strategies for Puppet code upgrade and refactoringAlessandro Franceschi
 
Build and Deploy Sites Using Features
Build and Deploy Sites Using Features Build and Deploy Sites Using Features
Build and Deploy Sites Using Features Phase2
 
Drupal Camp Porto - Developing with Drupal: First Steps
Drupal Camp Porto - Developing with Drupal: First StepsDrupal Camp Porto - Developing with Drupal: First Steps
Drupal Camp Porto - Developing with Drupal: First StepsLuís Carneiro
 
First Steps in Drupal Code Driven Development
First Steps in Drupal Code Driven DevelopmentFirst Steps in Drupal Code Driven Development
First Steps in Drupal Code Driven DevelopmentNuvole
 
Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Drupalcon Paris
 
Configuration Management in Drupal 8: A preview (DrupalDays Milano 2014)
Configuration Management in Drupal 8: A preview (DrupalDays Milano 2014)Configuration Management in Drupal 8: A preview (DrupalDays Milano 2014)
Configuration Management in Drupal 8: A preview (DrupalDays Milano 2014)Nuvole
 
Drupal distributions - how to build them
Drupal distributions - how to build themDrupal distributions - how to build them
Drupal distributions - how to build themDick Olsson
 
Gestione della configurazione in Drupal 8
Gestione della configurazione in Drupal 8Gestione della configurazione in Drupal 8
Gestione della configurazione in Drupal 8Eugenio Minardi
 
Using Drupal Features in B-Translator
Using Drupal Features in B-TranslatorUsing Drupal Features in B-Translator
Using Drupal Features in B-TranslatorDashamir Hoxha
 
Features everywhere
Features everywhere Features everywhere
Features everywhere Mediacurrent
 
Staying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPStaying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPOscar Merida
 
Open Atrium (DrupalCon Paris 2009, Day 3)
Open Atrium (DrupalCon Paris 2009, Day 3)Open Atrium (DrupalCon Paris 2009, Day 3)
Open Atrium (DrupalCon Paris 2009, Day 3)Cameron Eagans
 
IBM Drupal Users Group Discussion on Managing and Deploying Configuration
IBM Drupal Users Group Discussion on Managing and Deploying ConfigurationIBM Drupal Users Group Discussion on Managing and Deploying Configuration
IBM Drupal Users Group Discussion on Managing and Deploying ConfigurationDevelopment Seed
 
Package management and creation in Gentoo Linux
Package management and creation in Gentoo LinuxPackage management and creation in Gentoo Linux
Package management and creation in Gentoo LinuxDonnie Berkholz
 
Introduction And Basics of Modules in Drupal 7
Introduction And Basics of Modules in Drupal 7 Introduction And Basics of Modules in Drupal 7
Introduction And Basics of Modules in Drupal 7 Dhinakaran Mani
 

Similar to CapitalCamp Features (20)

Intro to Features Module on Drupal
Intro to Features Module on DrupalIntro to Features Module on Drupal
Intro to Features Module on Drupal
 
Staying Sane with Drupal (A Develper's Survival Guide)
Staying Sane with Drupal (A Develper's Survival Guide)Staying Sane with Drupal (A Develper's Survival Guide)
Staying Sane with Drupal (A Develper's Survival Guide)
 
Building and Maintaining a Distribution in Drupal 7 with Features
Building and Maintaining a  Distribution in Drupal 7 with FeaturesBuilding and Maintaining a  Distribution in Drupal 7 with Features
Building and Maintaining a Distribution in Drupal 7 with Features
 
Strategies for Puppet code upgrade and refactoring
Strategies for Puppet code upgrade and refactoringStrategies for Puppet code upgrade and refactoring
Strategies for Puppet code upgrade and refactoring
 
Build and Deploy Sites Using Features
Build and Deploy Sites Using Features Build and Deploy Sites Using Features
Build and Deploy Sites Using Features
 
Drupal Camp Porto - Developing with Drupal: First Steps
Drupal Camp Porto - Developing with Drupal: First StepsDrupal Camp Porto - Developing with Drupal: First Steps
Drupal Camp Porto - Developing with Drupal: First Steps
 
First Steps in Drupal Code Driven Development
First Steps in Drupal Code Driven DevelopmentFirst Steps in Drupal Code Driven Development
First Steps in Drupal Code Driven Development
 
Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3
 
Configuration Management in Drupal 8: A preview (DrupalDays Milano 2014)
Configuration Management in Drupal 8: A preview (DrupalDays Milano 2014)Configuration Management in Drupal 8: A preview (DrupalDays Milano 2014)
Configuration Management in Drupal 8: A preview (DrupalDays Milano 2014)
 
Drupal distributions - how to build them
Drupal distributions - how to build themDrupal distributions - how to build them
Drupal distributions - how to build them
 
Gestione della configurazione in Drupal 8
Gestione della configurazione in Drupal 8Gestione della configurazione in Drupal 8
Gestione della configurazione in Drupal 8
 
Features
FeaturesFeatures
Features
 
Using Drupal Features in B-Translator
Using Drupal Features in B-TranslatorUsing Drupal Features in B-Translator
Using Drupal Features in B-Translator
 
Features everywhere
Features everywhere Features everywhere
Features everywhere
 
Staying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPStaying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHP
 
Open Atrium (DrupalCon Paris 2009, Day 3)
Open Atrium (DrupalCon Paris 2009, Day 3)Open Atrium (DrupalCon Paris 2009, Day 3)
Open Atrium (DrupalCon Paris 2009, Day 3)
 
IBM Drupal Users Group Discussion on Managing and Deploying Configuration
IBM Drupal Users Group Discussion on Managing and Deploying ConfigurationIBM Drupal Users Group Discussion on Managing and Deploying Configuration
IBM Drupal Users Group Discussion on Managing and Deploying Configuration
 
Package management and creation in Gentoo Linux
Package management and creation in Gentoo LinuxPackage management and creation in Gentoo Linux
Package management and creation in Gentoo Linux
 
Introduction And Basics of Modules in Drupal 7
Introduction And Basics of Modules in Drupal 7 Introduction And Basics of Modules in Drupal 7
Introduction And Basics of Modules in Drupal 7
 
Go Faster With Native Compilation
Go Faster With Native CompilationGo Faster With Native Compilation
Go Faster With Native Compilation
 

More from Phase2

Phase2 Health and Wellness Brochure
Phase2 Health and Wellness BrochurePhase2 Health and Wellness Brochure
Phase2 Health and Wellness BrochurePhase2
 
A Modern Digital Experience Platform
A Modern Digital Experience PlatformA Modern Digital Experience Platform
A Modern Digital Experience PlatformPhase2
 
Beyond websites: A Modern Digital Experience Platform
Beyond websites: A Modern Digital Experience PlatformBeyond websites: A Modern Digital Experience Platform
Beyond websites: A Modern Digital Experience PlatformPhase2
 
Omnichannel For Government
Omnichannel For Government Omnichannel For Government
Omnichannel For Government Phase2
 
Bad camp2016 Release Management On Live Websites
Bad camp2016 Release Management On Live WebsitesBad camp2016 Release Management On Live Websites
Bad camp2016 Release Management On Live WebsitesPhase2
 
A FUTURE-FOCUSED DIGITAL PLATFORM WITH DRUPAL 8
A FUTURE-FOCUSED DIGITAL PLATFORM WITH DRUPAL 8A FUTURE-FOCUSED DIGITAL PLATFORM WITH DRUPAL 8
A FUTURE-FOCUSED DIGITAL PLATFORM WITH DRUPAL 8Phase2
 
The Future of Digital Storytelling - Phase2 Talk
The Future of Digital Storytelling - Phase2 TalkThe Future of Digital Storytelling - Phase2 Talk
The Future of Digital Storytelling - Phase2 TalkPhase2
 
Site building with end user in mind
Site building with end user in mindSite building with end user in mind
Site building with end user in mindPhase2
 
Fields, entities, lists, oh my!
Fields, entities, lists, oh my!Fields, entities, lists, oh my!
Fields, entities, lists, oh my!Phase2
 
Performance Profiling Tools and Tricks
Performance Profiling Tools and TricksPerformance Profiling Tools and Tricks
Performance Profiling Tools and TricksPhase2
 
NORTH CAROLINA Open Source, OpenPublic, OpenShift
NORTH CAROLINA Open Source, OpenPublic, OpenShiftNORTH CAROLINA Open Source, OpenPublic, OpenShift
NORTH CAROLINA Open Source, OpenPublic, OpenShiftPhase2
 
Drupal 8 for Enterprise: D8 in a Changing Digital Landscape
Drupal 8 for Enterprise: D8 in a Changing Digital LandscapeDrupal 8 for Enterprise: D8 in a Changing Digital Landscape
Drupal 8 for Enterprise: D8 in a Changing Digital LandscapePhase2
 
Riding the Drupal Wave: The Future for Drupal and Open Source Content Manage...
Riding the Drupal Wave:  The Future for Drupal and Open Source Content Manage...Riding the Drupal Wave:  The Future for Drupal and Open Source Content Manage...
Riding the Drupal Wave: The Future for Drupal and Open Source Content Manage...Phase2
 
Site Building with the End User in Mind
Site Building with the End User in MindSite Building with the End User in Mind
Site Building with the End User in MindPhase2
 
The Yes, No, and Maybe of "Can We Build That With Drupal?"
The Yes, No, and Maybe of "Can We Build That With Drupal?"The Yes, No, and Maybe of "Can We Build That With Drupal?"
The Yes, No, and Maybe of "Can We Build That With Drupal?"Phase2
 
User Testing For Humanitarian ID App
User Testing For Humanitarian ID AppUser Testing For Humanitarian ID App
User Testing For Humanitarian ID AppPhase2
 
Redhat.com: An Architectural Case Study
Redhat.com: An Architectural Case StudyRedhat.com: An Architectural Case Study
Redhat.com: An Architectural Case StudyPhase2
 
The New Design Workflow
The New Design WorkflowThe New Design Workflow
The New Design WorkflowPhase2
 
Drupal 8, Don’t Be Late (Enterprise Orgs, We’re Looking at You)
Drupal 8, Don’t Be Late (Enterprise Orgs, We’re Looking at You)Drupal 8, Don’t Be Late (Enterprise Orgs, We’re Looking at You)
Drupal 8, Don’t Be Late (Enterprise Orgs, We’re Looking at You)Phase2
 
Memorial Sloan Kettering: Adventures in Drupal 8
Memorial Sloan Kettering: Adventures in Drupal 8Memorial Sloan Kettering: Adventures in Drupal 8
Memorial Sloan Kettering: Adventures in Drupal 8Phase2
 

More from Phase2 (20)

Phase2 Health and Wellness Brochure
Phase2 Health and Wellness BrochurePhase2 Health and Wellness Brochure
Phase2 Health and Wellness Brochure
 
A Modern Digital Experience Platform
A Modern Digital Experience PlatformA Modern Digital Experience Platform
A Modern Digital Experience Platform
 
Beyond websites: A Modern Digital Experience Platform
Beyond websites: A Modern Digital Experience PlatformBeyond websites: A Modern Digital Experience Platform
Beyond websites: A Modern Digital Experience Platform
 
Omnichannel For Government
Omnichannel For Government Omnichannel For Government
Omnichannel For Government
 
Bad camp2016 Release Management On Live Websites
Bad camp2016 Release Management On Live WebsitesBad camp2016 Release Management On Live Websites
Bad camp2016 Release Management On Live Websites
 
A FUTURE-FOCUSED DIGITAL PLATFORM WITH DRUPAL 8
A FUTURE-FOCUSED DIGITAL PLATFORM WITH DRUPAL 8A FUTURE-FOCUSED DIGITAL PLATFORM WITH DRUPAL 8
A FUTURE-FOCUSED DIGITAL PLATFORM WITH DRUPAL 8
 
The Future of Digital Storytelling - Phase2 Talk
The Future of Digital Storytelling - Phase2 TalkThe Future of Digital Storytelling - Phase2 Talk
The Future of Digital Storytelling - Phase2 Talk
 
Site building with end user in mind
Site building with end user in mindSite building with end user in mind
Site building with end user in mind
 
Fields, entities, lists, oh my!
Fields, entities, lists, oh my!Fields, entities, lists, oh my!
Fields, entities, lists, oh my!
 
Performance Profiling Tools and Tricks
Performance Profiling Tools and TricksPerformance Profiling Tools and Tricks
Performance Profiling Tools and Tricks
 
NORTH CAROLINA Open Source, OpenPublic, OpenShift
NORTH CAROLINA Open Source, OpenPublic, OpenShiftNORTH CAROLINA Open Source, OpenPublic, OpenShift
NORTH CAROLINA Open Source, OpenPublic, OpenShift
 
Drupal 8 for Enterprise: D8 in a Changing Digital Landscape
Drupal 8 for Enterprise: D8 in a Changing Digital LandscapeDrupal 8 for Enterprise: D8 in a Changing Digital Landscape
Drupal 8 for Enterprise: D8 in a Changing Digital Landscape
 
Riding the Drupal Wave: The Future for Drupal and Open Source Content Manage...
Riding the Drupal Wave:  The Future for Drupal and Open Source Content Manage...Riding the Drupal Wave:  The Future for Drupal and Open Source Content Manage...
Riding the Drupal Wave: The Future for Drupal and Open Source Content Manage...
 
Site Building with the End User in Mind
Site Building with the End User in MindSite Building with the End User in Mind
Site Building with the End User in Mind
 
The Yes, No, and Maybe of "Can We Build That With Drupal?"
The Yes, No, and Maybe of "Can We Build That With Drupal?"The Yes, No, and Maybe of "Can We Build That With Drupal?"
The Yes, No, and Maybe of "Can We Build That With Drupal?"
 
User Testing For Humanitarian ID App
User Testing For Humanitarian ID AppUser Testing For Humanitarian ID App
User Testing For Humanitarian ID App
 
Redhat.com: An Architectural Case Study
Redhat.com: An Architectural Case StudyRedhat.com: An Architectural Case Study
Redhat.com: An Architectural Case Study
 
The New Design Workflow
The New Design WorkflowThe New Design Workflow
The New Design Workflow
 
Drupal 8, Don’t Be Late (Enterprise Orgs, We’re Looking at You)
Drupal 8, Don’t Be Late (Enterprise Orgs, We’re Looking at You)Drupal 8, Don’t Be Late (Enterprise Orgs, We’re Looking at You)
Drupal 8, Don’t Be Late (Enterprise Orgs, We’re Looking at You)
 
Memorial Sloan Kettering: Adventures in Drupal 8
Memorial Sloan Kettering: Adventures in Drupal 8Memorial Sloan Kettering: Adventures in Drupal 8
Memorial Sloan Kettering: Adventures in Drupal 8
 

Recently uploaded

Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 

Recently uploaded (20)

Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 

CapitalCamp Features

  • 1. THE LEADER IN DRUPAL PLATFORM DESIGN AND DEVELOPMENT Tuesday, July 31, 12
  • 2. BUILDING AND DEPLOYING SITES USING FEATURES Tuesday, July 31, 12
  • 3. BUILDING AND DEPLOYING SITES USING FEATURES • Mike Potter Phase2 Technology • Maintainer of Features and Features Override modules • mpotter on Drupal.org • #drupal-features IRC channel Tuesday, July 31, 12
  • 4. DRUPAL ARCHITECTURE Web Server Web Database Browser Content File System Configuration Code Configuration FEATURES Tuesday, July 31, 12
  • 5. FEATURES • Brings configuration from the Database into Code. (called an exportable) • A Feature is a Drupal Module. • The Features Module provides a User Interface for manipulating features. Tuesday, July 31, 12
  • 6. WHY? • Separates Site configuration from Site content. • Encapsulates functionality into a package that can be used on multiple sites. • Allows version control (track changes, revert, etc). • Easier deployment. • Saves development time!! Tuesday, July 31, 12
  • 7. EXPORTABLE TYPES • Content Types, Fields, Menus, Taxonomies, Text formats, Image styles, User roles and permissions, Views, CTools, Context CORE • System variables (Strongarm) • Node queues, Boxes (blocks), Nodes (content), Panels, Commerce products, many more. • Any module can support exporting as Feature. Tuesday, July 31, 12
  • 8. USAGE CASES • Bundle some functionality into a Feature e.g. Photo Gallery contains Content Type, Fields, Views • Deploy configuration data using a Feature e.g. Transfer user permissions from Dev server to Production. Tuesday, July 31, 12
  • 9. DEMO TIME ! Tuesday, July 31, 12
  • 10. /admin/structure/features/create MAKE A NEW FEATURE Tuesday, July 31, 12
  • 11. FEATURE IS A MODULE • Downloading a Feature creates .tar package • Install just like any normal module • Enable the module /sites/all/modules/features Tuesday, July 31, 12
  • 12. IT’S ALL IN THE CODE! the “default hook” cats.info cats.features.inc name = Cats /** description = Description of Cats feature * Implements hook_node_info(). core = 7.x */ package = Cat Package function cats_node_info() { php = 5.2.4 $items = array( dependencies[] = features 'cat' => array( dependencies[] = image 'name' => t('Cat'), dependencies[] = link 'base' => 'node_content', dependencies[] = node_reference 'description' => '', eatures[features_api][] = api:1 'has_title' => '1', features[field][] = node-cat-body 'title_label' => t('Name'), features[field][] = node-cat-field_age 'help' => '', features[field][] = node-cat-field_cat_image ), features[field][] = node-cat-field_test_link ); features[field][] = node-cat-field_test_ref return $items; features[node][] = cat } Features will keep your changes to *.module and any other files you add Tuesday, July 31, 12
  • 13. IT’S ALL (MOSTLY) IN THE CODE! • “Pure” Exportables • “Faux” exportables - all in code - some code - nothing in DB - some config in DB • Views, CTools, etc • Fields uses existing module requires Features hooks don’t need Features Tuesday, July 31, 12
  • 14. UPDATING A FEATURE • Make a manual change to • “Recreate” the feature to the database add new data to code configuration or • “Revert” the feature to • Feature exportable is restore original config marked as “Overridden” click Tuesday, July 31, 12
  • 15. REVERT VS RECREATE Revert Database Code on disk Recreate Tuesday, July 31, 12
  • 16. USING DRUSH WITH FEATURES • If anybody doesn’t know about Drush then time for a quick DEMO! drupal.org/projects/drush All commands in features: (features) features-add (fa) Add a component to a feature module. features-diff (fd) Show the difference between the default and overridden state of a feature. features-export (fe) Export a feature from your site into a module. features-list (fl, List all the available features for your site. features) features-revert (fr) Revert a feature module on your site. features-revert-all Revert all enabled feature module on your site. (fr-all, fra) features-update (fu) Update a feature module on your site. features-update-all Update all feature modules on your site. (fu-all, fua) Tuesday, July 31, 12
  • 17. REVERTING FEATURES USING DRUSH $ drush fl Name Feature Status State Distro Article distro_article Enabled Distro User distro_user Disabled Distro View distro_view Enabled Overridden $ drush fd distro_view Legend: Code: drush features-revert will remove the overrides. RED is Code Overrides: drush features-update will update the exported feature with the displayed overrides Component: views_view GREEN is Database /* Display: Master */ $handler = $view->new_display('default', 'Master', 'default'); < $handler->display->display_options['title'] = 'My Cat List'; --- > $handler->display->display_options['title'] = 'My Cat List New'; $handler->display->display_options['access']['type'] = 'perm'; $handler->display->display_options['cache']['type'] = 'none'; Tuesday, July 31, 12
  • 18. REVERTING FEATURES USING DRUSH - 2 Keep RED Code (Code Database) $ drush fr distro_view Do you really want to revert views_view? (y/n): y Reverted views_view. Keep GREEN Database (Database Code) $ drush fu distro_view Module appears to already exist in sites/all/modules/features/distro_view Do you really want to continue? (y/n): y Created module: distro_view in sites/all/modules/features/distro_view Tuesday, July 31, 12
  • 19. DEBUGGING OVERRIDDEN FEATURES When Reverting fails to remove Overridden • Use “drush fd” to see what is different • Make sure difference isn’t provided by a disabled module. • If a View, try Reverting from the Views UI • Last resort: try editing code manually, or making database change manually to match code. Tuesday, July 31, 12
  • 20. FEATURES SERVER drupal.org/project/fserver • Allows features to be shared, distributed and updated. • No longer in wide use because of alternatives: drupal.org sandboxes, github, and Apps Tuesday, July 31, 12
  • 21. APPS drupal.org/project/apps • An App is a Feature(s) along with a manifest that allows it to be distributed via an App Server. • An App is a clean, polished, modular piece of functionality. • Apps are currently used mostly by Distributions to supply optional functionality. Tuesday, July 31, 12
  • 22. OVERRIDES • Using a Feature that you don’t want to change? (e.g. comes from a base Distribution like OpenPublish) • Client made site-specific configuration changes? • Capture those changes into a NEW feature called an “Override” Tuesday, July 31, 12
  • 23. FEATURES OVERRIDE MODULE • Rewritten for D7 to be easier to use • Generates simple code for overrides • Allows line-level inspection of overrides • Uses existing “alter” hooks drupal_alter(‘default_hook’, $data); Called by Drupal function override_feature_views_default_views_alter(&$data) { if (isset($data['cat_fields'])) { $data['cat_fields']->display['default']->display_options['title'] = 'New Cat View title'; /* WAS: 'My Cat List' */ } } Code in Override feature Tuesday, July 31, 12
  • 24. FEATURES OVERRIDE DEMO I can’t look! Tuesday, July 31, 12
  • 25. EXTRA DOUBLE-SECRET PROBATION DEMO • Change a View • Add a field to a View • Remove a field from a View • All in ONE Override! Tuesday, July 31, 12
  • 26. INSPECTING OVERRIDES • Old method (Review Overrides using diff module) Tuesday, July 31, 12
  • 27. INSPECTING OVERRIDES • New method (Overrides using Features Override) Tuesday, July 31, 12
  • 28. WHAT DOES THIS ALL MEAN? (CASE 1) • Use a Distribution containing features. • Customize site for specific Client needs. • Capture changes to a Features Override. • New version of Distribution released? • Just install new features • Site-specific changes are maintained in Override. Tuesday, July 31, 12
  • 29. WHAT DOES THIS ALL MEAN? (CASE 2) • Build site for client using Features. • Deploy from your Dev server to Staging. • Deploy from Staging to Production. • Client makes emergency changes to live Production. • Capture those changes into Features Override • Keep separate or roll back into Dev features Tuesday, July 31, 12
  • 30. BOTTOM LINE • Use Features. They will save you. • Use Overrides. They will make you a star! QUESTIONS? #drupal-features mpotter@phase2technology.com Tuesday, July 31, 12