Drupal 8 is ready for prime time, but here's what you should plan for

Drupal 8

You may have noticed our new website (launched but being improved), and we built it on Drupal 8!  As you may know, Drupal 8 is an object-oriented framework, which I love. Everything is a class that can be extended, which makes the entire process of doing custom development much, much easier, and probably safer overall. But if a client asked me to build their site on Drupal, I'd probably say... "Yes, but be prepared for a little pain."

First off, many of the most useful modules have been moved into core: Views is the most notable.  As a result, the number of contrib modules I install has drastically decreased in number.  I like this!

Contribute this

And as to the pain, here's a list of contrib modules that I normally rely on that are not yet ported over to D8, or don't have a stable release:

  • SMTP - This one was a serious issue for me.  We host our site on Pantheon, which is a cloud-based hosting service.  You generally don't want to use the mail servers that come with the hosting, because the IP address can be any within a range of addresses, so you can't really set up an SPF record.  As a result, our contact form sends us contact emails, but they end up in spam filters unless we take pains to set up filters to ensure otherwise.  I attempted to address this by installing SMTP and configuring it to use sendgrid, but it simply didn't work.
  • PathAuto: Another one that I'm sorely missing.  PathAuto is the module that permits setting up of URL patterns and automatic URL generation based on title.  Until this is ready, we have to craft the URL for each node manually, taking care to ensure that paths are correct.
  • Redirect: We migrated our content over, so we needed to set up redirects from the old URLs to the new URLs.  GlobalRedirect was my go-to module in D7, but it is not being ported to D8.  The module maintainers recommended Redirect for D8, but Redirect does not yet have a dev version.  Luckily, they DO have a pre-dev version that I grabbed a copy of and it seems to get the job done, for the most part.  I couldn't add redirects from their main configuration screen, but I WAS able to get redirects in via the "Fix 404 Errors" screen, so that worked out alright.
  • HybridAuth: This one isn't a module we needed, but its one that's nice to have for many use-cases.  This module is what permits logging in with your social media accounts (Facebook, Twitter, Google+, etc).  The work of porting it over to D8 has not yet begun.
  • SmartTrim: This is the module that intelligently trims your body content for use in teaser view modes, removing markup (if configured to do so) and trimming to the specified number of characters.  Its not ready, yet, so I ended up implementing a custom solution to accomplish this.
  • Webform: This module permits quick & easy creation of forms (both full page and block versions).   I ended up creating forms in a custom module for our contact form and support form.  Forms API is pretty easy to use, so this one wasn't a big deal to me.
  • Context: This is one of my favorite contrib modules, permitting you a large degree of control over your website, with a large number of "triggers" available (by path, by node type, by view, etc) and an equally large number of "responses" (block placement, adding classes to the body tag, disabling regions in your theme, etc).  I sorely missed this one, but the workaround wasn't too bad.  Ultimately I created preprocess functions in the theme file, and passed blocks through to the twig templates as variables for Feld to wrap and place as he pleased.  We could have used the core block layout to accomplish this to a degree, but we would have lost the fine-tuning of the markup.

Other gotchas

I found a bug with taxonomy-based sub-queries both in views AND in custom entityQuerys.  To summarize, using a sub-query to filter by taxonomy would do nothing, or I found inconsistent results.  I implemented a workaround by structuring my custom queries differently and using custom blocks instead of views.

I also discovered that installing/uninstalling modules ALWAYS white-screens.  This hasn't resulted in any serious issues (SMTP module being the exception--I can't uninstall it).

And debugging is painful!  This may be due to the hosting environment configuration (Pantheon).  I found that I rarely see errors (instead, I see the page processing halt at the content generation point, or a WSOD).  So the bulk of my debugging involved kint and careful scrutiny of the logic.  I also found that twig dump wasn't working.  Again, possibly due to the server configuration, but I'm not certain.

The Disqus module is easy to use, as before.  I found that enabling the disqus comments AFTER your content is migrated is a bad, bad idea.  Reason for this is that disqus commenting must be manually enabled on EACH and EVERY node if done AFTER the content is entered.  So, all 72 blog posts had to be edited and re-saved. 

What about media, you ask. There weren't any good solutions for rendering video, so I ultimately wrote a custom field formatter for a link field, for easy embedding of responsive Vimeo video.  I ddidn't mind this, because it gave me the opportunity to write the field formatter, which was fun to do. Same issue with audio.  Ultimately I created a second custom field formatter for our podcasts.

Go Drupal 8!

Overall, I love Drupal 8, mostly due to the object-oriented framework.  Our frontend developer loves his twig templates.  Accessing node fields is so easy, now, with get methods on the node to get at the data (I have strong memories of dumping node arrays to the screen in D7 so that I could determine the exact path to the field value I needed). Also, you now bundle CSS and JS into a single "library" in your library yml file, and include the single library with your block, rather than separate CSS and JS includes.  Seems so much cleaner to me.

So if you are thinking of moving to D8, I say, "Go for it."