After attending the recent Drupaldelphia camp in April, I wanted to revisit the recent changes that came about with the Drupal 8 release.
Many new features and changes
- Core has many additions, including Views, a breakpoint module, multilingual content, CKEditor, and inline editing of blocks.
- Drupal 8 now uses many parts of the Symfony 2.7 framework – HttpFoundation, HttpKernal, Routing, EventDispatcher, DependencyInjection, and ClassLoader. It also now uses a new templating framework called Twig. ex. http://cgit.drupalcode.org/drupal/plain/core/modules/node/templates/node.html.twig?id=refs/heads/8.0.x
- The new version has improved responsive design where images can now be resized based on breakpoints and the Admin has been redisned to work on mobile devices.
- Configuration data is now stored in files, which makes managing configuration with git much easier, and that data can now be imported and exported.
- The REST and Serialization webservices are now supported.
- All Core modules can now be found in the Core folder. The modules folder can now contain modules instead of needing to access sites/all/modules.
- New Fields are now available for Date, Email, Link, Reference, and Telephone.
- Fields can now be added to Nodes, Blocks, Comments, Contact Forms, Taxonomy terms, and Users.
Drupal 8 also includes updates to Module development.
- Modules are now a mash-up of old Drupal conventions and Symfony conventions. Porting modules from D6/D7 to D8 is possible but will take a decent bit of effort.
- .info files are now .info.yml ex. https://www.drupal.org/node/1935708
- Module development now follows an MVC pattern and is more object-oriented. The General Controllers are placed in the lib/Drupal/[module]/Controller folder following Symfony guidelines so that autoloaders will work. Form Controllers are placed in the lib/Drupal/[module]/form folder.
- Routing is now done by a routing.yml file.
- Hooks still remain, such as hook_menu.
Additional information on modules can be found here:
- https://github.com/iwhitcomb/foobar
- https://getlevelten.com/blog/ian-whitcomb/drupal-8-module-development-part-1-getting-started
- https://www.drupal.org/developing/modules/8
Upgrading to Drupal 8
The suggested method for upgrading a D6 or D7 site to Drupal 8 is to set up a Drupal 8 site, then import the configuration and content, with some caveats. The supported migrations focused on D6 since it is now end of life. Drupal 6 supported migrations are Core, CCK, Link, Email, Phone, and ImageCache modules. Drupal 7 currently only supports migration of content, users, taxonomy, blocks, menus, and filter formats.
Upgrade Requirements:
- Fresh install of Drupal 8 with the Migrate Drupal module enabled
- Access to the Drupal 6 or 7 database from the host where your new Drupal 8 site is located.
- Access to the source site’s files.
- The Migrate Upgrade module installed and enabled on the Drupal 8 site.
- Drush 8 (recommended)
- If migrating private files from Drupal 7, configure the Drupal 8 file_private_path path in settings.php before running the upgrade.
Upgrade Outline
- Download and install the required modules. Remember not all modules have been ported to D8 and some have been split – for example, Block has been split into Block and Custom Block.
- Run the upgrade
- UI-based via /upgrade URL is good for lightweight sites. This is useful for small site migrations, you fill in the fields and let the magic happen. You’re rewarded with a pretty report at the end.
- Drush (preferred) is the only option for large datasets.
- Drush migrate-upgrade to generate the migrations. You can configure for more control over individual migrations.
- Drush migrate-import to run migrations for individual items, after migrate-upgrade has been used with –configure-only.
There are some gotchas to look out for when upgrading:
- Views do not migrate and must be recreated.
- PHP filtering has been dropped.
- Many contrib modules have not been ported to D8.
- A good bit of stuff is still missing from the D7 upgrade system.
- D8 requires PHP 5.5.9, so older systems may require a PHP update.
- A full list of known issues (many related to D6) can be found here: https://www.drupal.org/node/2167633
If you’ve found other tricks or tips or gotchas with your Drupal 8 upgrade, let us know in the comments.