Vous êtes sur la page 1sur 1

Features Override | Drupal.

org

8/14/2014

Feat ur es O ver r ide | Dr upal. or g

Features Override
Last updated June 5, 2014. Created by nedjo on October 18, 2011.
Edited by gaele, shamio, scottrigby. Log in to edit this page.

Overview
Features Override allows you to selectively save customizations that have been made to a Features-based site, facilitating the process of upgrading
to a new version of the features in use. These instructions are for the 2.x version of Features Override.

Explanation
Features allows site configuration to live "in code", meaning that the configuration is read from the code of a module. These code-based
components are referred to as the "default" versions. For example, a feature module might provide one or more default views.
When changes have been made to a component, e.g., when you edit a default view, those changes are saved into the database. This component is
now said to be "overridden"--it has a default code-based version, but that version has been overridden by what's saved in the database.
At any time, you can choose to delete the database version of a component. This is termed "reverting". When you revert e.g. a view, the database
version of the view is deleted, leaving the original code version.
While overriding allows you to customize a feature, it comes at a cost. When you upgrade to a later release of the feature, you won't get all the
changes. Any components you've overridden will continue to live in your database and won't get any code-level changes that were made between
releases.
This is the problem that Features Override was written to address. By capturing not the whole overridden item but only the specific changes that
were made, Features Override allows you to return components to a clean, upgrade-ready default state while retaining the changes that were made.

Usage: saving overrides to a Drupal distribution


One of the main use cases for Features Override is to save customizations that have been made to a Drupal distribution like Open Atrium or Open
Outreach. Here's how.
What you'll be doing is saving changes to each component (view, content type, etc.) that you've customized and then exporting them to a new
feature. So if, e.g., you made changes to three views, two fields, and four panels, you would end up with 3 + 2 + 4 = 9 features override records.
Ensure you haven't upgraded the version of the features you're using. You need to capture your overrides before you upgrade.

Export overrides. The first step is to export the overrides you've made to components in existing features.
1. Install and enable an existing feature. An example might be a View.
2. Make changes to your site using the normal Drupal UI. For example, edit a View the change its title or which fields are displayed.
3. Back up your site's database. You will be making significant changes and may need to restore.
4. Install Features Override
5. At admin/structure/features, notice the original feature is marked "Overridden". Click "Create Feature" to create a new feature.
6. Select "Features Overrides" from the Edit components drop-down selector.
7. Check the box next to the components you wish to save changes to (such as the View).
8. Click Download to download your new "override" feature.
9. Install and enable the new "override" feature just as you would with any other feature/module. Notice that nothing is marked as "overridden"
anymore.
10. Disable your "Override Feature" to remove the changes. Enable it to restore the changes.
11. This feature can now be added to sites that have the original feature you overrode.
12. Use the new "Review Overrides" tab to view site changes on a line-by-line basis, improved over the older "diff" method that often didn't
show enough context about the change.
Revert all overrides. Now that you have pushed the changes you made to overrides, you can "revert" the features. This will ensure that your site
is clean and ready for updating.
Disable your new overrides feature. You need to do this to ensure that the components appear as overridden.
Select each of your other existing features that you are making override changes to and - provided you're certain you exported all of its
overrides - revert all of its components.
Re-enable your new overrides feature.
Upgrade your features. Now that you've captured your overrides and returned all components to their default state, you're free to upgrade to the
latest release of the distribution you're using. When you upgrade, you will receive the latest, code-based versions of all components, plus your
code-based overrides.
Test. Go through each area of functionality covered by your overrides and ensure it still works.

Risks
Overrides are tied to the original structure of a component, and for this reason may not work after upgrading. Say for example that you've changed
the title of a views display and saved that change as an override, then upgraded to a newer version of the original feature. If in the new version the
machine name of the view or display has changed, your override will be broken.

https://www.drupal.org/node/1313910

1/1

Vous aimerez peut-être aussi