README.txt 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. Features Override (Drupal 7-2.x)
  2. --------------------------------
  3. This module add a new Features exportable called "Feature Overrides" that
  4. are used to export overridden changes to other Features. It requires at
  5. least the 7.x-1.0-rc1 release of Features.
  6. To use, install this module and enable it. When you create a new feature from
  7. the Structure/Features page, two new exportables called "Feature Overrides"
  8. will be displayed in the drop-down list. The first one allows you to override
  9. all of the changes of a specific component. The second "Individual Advanced"
  10. allows you to select exactly which line-by-line changes are exported.
  11. Select the Overrode exportable and then select which components you wish to
  12. export overrides for. Only components that are currently overridden will be
  13. shown as checkboxes.
  14. Maintainers
  15. -----------
  16. - mpotter (Mike Potter)
  17. Basic Usage
  18. -----------
  19. 1) Create normal features and enable them.
  20. 2) Make changes to the site using the normal Drupal UI.
  21. 3) Go to the admin/structure/features page and you should see some of your
  22. Features marked as "Overridden"
  23. 4) Click the "Create Feature" tab.
  24. 5) Enter a name for your Override feature.
  25. 6) Click the "Edit components" drop-down and select "Feature Overrides".
  26. A list of overridden components will be shown. For example, if you changed a
  27. field in a content type, that field name will be shown in the list of
  28. overrides. If you changed something in a view, that view name will be in the
  29. list. Check the boxes next to the overrides you wish to save.
  30. 7) Click the "Download Feature" button at the bottom of the screen. This will
  31. create your Override Feature module code and save it to a local file. Upload
  32. that file to your server and place it into your normal sites/all/modules
  33. directory.
  34. 8) Go to the Modules page and Enable your new override module.
  35. 9) Clear the Drupal cache.
  36. 10) Now when you visit the admin/structure/features you should see your new
  37. override feature and the original features should no longer be marked as
  38. "Overridden".
  39. Merging new changes into an existing Override
  40. ---------------------------------------------
  41. Once you have created an Override feature, it's easy to add additional changes
  42. to it:
  43. 1) Make changes to the site via the Drupal UI
  44. 2) Visit admin/structure/features and you should see both the original code
  45. feature marked as "Overridden" as well as the Override feature marked as
  46. "Overridden"
  47. 3) Click the Recreate link for the Override feature.
  48. 4) Select any new overrides from the Component dropdown list as needed.
  49. Download your new feature.
  50. You can accomplish this same task using Drush:
  51. drush features-update override-feature
  52. 5) Now visit the Features admin page and nothing should be marked as Overridden
  53. again.
  54. NOTE: You want to update/recreate the Override feature and NOT the original
  55. feature. If you recreate the original feature, then ALL of the overrides (the
  56. existing ones in the Override module and the new changes) will be written to
  57. the original feature. Probably not what you wanted (see next section)
  58. Rebuilding the Original Feature without the Overrides
  59. -----------------------------------------------------
  60. Sometimes you want to make a change and have that change saved with the
  61. original feature and not with the Override. Here are the steps to accomplish
  62. this:
  63. 1) Make the changes you need to the site via the Drupal UI
  64. 2) Visit admin/structure/features and you should see both the original code
  65. feature marked as "Overridden" as well as the Override feature marked as
  66. "Overridden"
  67. 3) Click the "Create Feature" tab to create a new feature
  68. 4) Create a new Override feature by entering a name and description, then
  69. select the overrides you want to save from the Feature Override section of the
  70. Components drop-down menu
  71. 5) Click Download Feature and install this new module on your site. Let's
  72. call it "New Changes". So now we have the "Original Feature", the first
  73. "Override Feature", and the new "New Changes" feature. All three should
  74. display in the Features Admin page in their Default state.
  75. 6) From the Features Admin page, uncheck the "New Changes" feature you created
  76. in step 5, then click Save. This will undo the recent changes.
  77. 7) From the Features Admin page, uncheck the box next to the "Override Feature"
  78. that you originally created (NOT the New one you made in step 5) and click
  79. Save. This will undo the changes made by the first Override module.
  80. 8) If the original feature shows as "Overridden" or "Needs Review", click on
  81. it and click the Revert button to ensure it is in it's original state.
  82. 9) From the Features Admin page, check the box next to the "New Changes"
  83. feature you created in step 5 to enable is and click Save. Now the database
  84. reflects the original feature plus the new changes.
  85. 10) Click the Recreate link for the original Feature. Click the Download link
  86. and install the updated feature. Or use the drush command:
  87. "drush features-update original-feature". This will export the original
  88. feature code along with the New Changes code.
  89. 11) You no longer need the New Changes feature. You can disable it and remove
  90. it from your site if you wish. If you don't remove it completely, at least
  91. ensure that it is disabled in the Feature Admin page.
  92. 12) Finally, check the box next to the Override feature to re-enable that
  93. feature. Now you have the original code plus the New changes stored in the
  94. original feature, but you still have the additional Overrides in the seperate
  95. Override module.
  96. Once you understand the above steps you will also realize that there are other
  97. ways to accomplish this same task. For example, you could have disabled the
  98. Override module first, then made your changes and just recreated the original
  99. feature directly. However, the above procedure is the most complete and
  100. reflects the real-life situation where the changes have already been made to
  101. the site and you need to somehow capture those changes back into the original
  102. feature.
  103. Adding or Removing specific Override lines
  104. ------------------------------------------
  105. An Override feature is simply a list of code changes that need to be made to
  106. the current configuration. Only code *differences* are stored in the Override
  107. feature.
  108. To view these specific line-by-line code differences, click the Default link
  109. next to your Override module from the Features admin page, then click the
  110. Review Overrides tab. This will show the Overrides currently exported as
  111. individual lines (along with the normal "diff" listing below).
  112. To change which specific lines are exported, click the Recreate tab, then
  113. open the Components dropdown. Select the "Features Overrides Individual"
  114. (advanced) tab. Then click the "Refine" link next to the component you want
  115. to adjust. Each specific override line will be shown as a checkbox. Simply
  116. check or uncheck the lines desired. Then click the Download button to create
  117. a new version of your Override feature.
  118. In the main Features Admin page there is also a new Review Overrides tab.
  119. This will show a list of any new overrides no matter which module that relate
  120. to. This is a very useful debugging tool for determining where changes have
  121. been made to your site. The Overrides tab will tell you the exact Component
  122. being overridden. The normal "Review Overrides" tab in Features only shows the
  123. raw code "diffs" and sometimes cannot show the full context of the change. The
  124. new Review Overrides tab can show you exactly what the change is and where it
  125. is made (which View changed, which field changed, etc).