I am udating an existing website from Drupal 7 to 8. The original developer placed most of the theme/items into Module Features (like a front page slider). I have about 37 Features that I need to move into Drupal 8.

I can get into the .info file and change some of the elements to be .yml compliant but there are feature variables included that I don't know how it should be coded.

Files are located in sites/all/modules/features/ without about 8 categories (blocks, configurations, content_types, core, forms, menus, nodequees and views) and multiple features under each category.

Example of one feature's .info file

# cat sites/all/modules/features/content_types/cf_content_types_homepage_slider/cf_content_types_homepage_slider.info
name = MySite Features: Content types: Homepage slider
core = 7.x
package = MySite Features: Content types
dependencies[] = cf_core_field_bases
dependencies[] = ctools
dependencies[] = features
dependencies[] = image
dependencies[] = link
dependencies[] = picture
dependencies[] = strongarm
dependencies[] = text
features[ctools][] = strongarm:strongarm:1
features[features_api][] = api:2
features[field_instance][] = node-homepage_slider-body
features[field_instance][] = node-homepage_slider-field_background_image
features[field_instance][] = node-homepage_slider-field_link
features[field_instance][] = node-homepage_slider-field_small_image
features[node][] = homepage_slider
features[variable][] = comment_anonymous_homepage_slider
features[variable][] = comment_default_mode_homepage_slider
features[variable][] = comment_default_per_page_homepage_slider
features[variable][] = comment_form_location_homepage_slider
features[variable][] = comment_homepage_slider
features[variable][] = comment_preview_homepage_slider
features[variable][] = comment_subject_field_homepage_slider
features[variable][] = field_bundle_settings_node__homepage_slider
features[variable][] = menu_options_homepage_slider
features[variable][] = menu_parent_homepage_slider
features[variable][] = node_options_homepage_slider
features[variable][] = node_preview_homepage_slider
features[variable][] = node_submitted_homepage_slider

Now I know some of the changes that need to be done for YAML such as changing the "=" for ":" and listing the dependencies.

I also know that 'strongarm' is now included in the Drupal 8 core.

name: 'MySite Features: Content types: Homepage slider'
core: 8.x
package: 'MySite Features: Content types'
type: module
  - cf_core_field_bases
  - ctools
  - features
  - image
  - link
  - picture
  - text

But then I'm stuck. I have only done some but even those

  1. I don't see them in the list of Modules or Feature Bundles
  2. I don't know how to reference all the features variables

I do not have experience with developing Features (didn't even know about them until now) or developing Modules.

Are there any good sites on how to convert a Feature from D7 to D8? I know about articles saying don't use Features in D8 but I need to get this site updated and don't have time to rebuild everything from scratch (even if I knew how to make all these capabilities work in a new site).

Any good sites to go over how Features work? Maybe if I learn the details of how these features were built I could understand how to change them over?

Any help?

  • 2
    Drupal 8's configuration is totally different from D7. I think you are going about this the wrong way. You should be looking at the migration tools to migrate the site from D7 to D8. Features just captures info in the DB into code... the migration process should let you migrate the D7 info from the DB.
    – CG Monroe
    May 13, 2020 at 21:22
  • Just a thought, if you're being pressured for a D8 upgrade, why not consider some D7 LTS maintenance strategy until you have the time/budget for a D8 upgrade where you can drop Features altogether rather than trying to rush an upgrade with software that its own maintainers acknowledge is mostly obsolete. That way, you'll have less to focus on and you can find more applicable examples of workable Features in D7 (when Features was in its prime) if you need to maintain the D7 Features code & site.
    – Shawn Conn
    May 13, 2020 at 21:27
  • As @CGMonroe already mentioned, don't try to convert D7 Features into D8 modules, you just need to Migrate from D7 to D8.
    – No Sssweat
    May 14, 2020 at 9:47
  • Thank you for the link. I have followed those steps, compiling from a couple of places, and am now re-going through the list of modules since the results were 91 Modules NOT to be updated (33 of them are those Features), and only 36 Modules are actually updated. I have updated the theme's INFO and LIBRARY files (for Twig) and updated some of the preprocessing for Drupal 8. Unfortunately much of the content (like the entire front page, a number of menus on the page) are generated from these Features and attempts to apply them using Blocks breaks the CSS styling.
    – Hometoy
    May 14, 2020 at 16:18


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.