Drupal 8 development, is it really that great?
With the advent of the new and long awaited Drupal 8 code base, it's time to evaluate its performance so far, is it all that we were expecting? Is it really that great? Purencool are currently developing a small Drupal 8 website and using the new theme layer and the new Drupal 8 API and site-building standards, we have found the new Kool-aid interesting and at the same time very very powerful tool.
You can see why they lead initiatives developed the Drupal 8 code base with these new technological changes. But, once you achieve a basic conceptual understanding of how the constraints of Twig and OOP operate, the old and loved Drupal way is still as powerful as in the past.
We needed to build custom forms and inject them into blocks
As everyone who is in 'the know' is aware, Drupal 8 has moved to Object Oriented PHP, and just let me say 'YES! YES! YES!, FINALLY!' The adoption of OOP is really great news and amazingly simple to use.
Under the current scope of works we were required to create custom forms that were to be injected into a block so it could be placed anywhere on the website and the form call back would need to access a REST API. Ooooh no, we had heard there were many issues with Drupal 8 forms. So, like all good Drupal developers we did what was expected, we took the following professional steps
- We looked at the Drupal 8 form API (and thought 'that doesn't sound too hard..')
- Searched for Drupal 8 examples on Drupal.org (Hmmmm.. yep, we have got this in the bag!)
- Installed the examples on a clean build (Dam Drupal, will you just work!)
- Ok now you are working, we will create a custom module using Drupal Console (What do you mean I need an Interface?..)
- Drupal Console is now working, we manually edited what was created (Please, Please, Please, I have the right namespace.. just work!)
- Yay! the Form Page has an input button and nothing else (I am now a professional developer)
- Now to injecting that form into a block (Piece of cake, watch me with Drupal Console)
- Created a block under the same namespace (What is that namespace again?)
- Injected the form into the block ('Do it as a Service..?' What the?)
- Now place the block on the website (annd we're done,..Phew! Ten hours later, eight coffees, two wines and a oh-so-close divorce")
To be honest is was not really that bad developing the forms to a stage that we had a workable example. We were able to add it to the build for testing, it took about three hours for the first one and twenty minutes for each one after that. Granted, they were not multistep forms and we did not have to store the data in the first iteration.
If you have a concept of how Object Orientated PHP works, you will be fine. The biggest issue we found was the conceptual way the folder structure works and how it ties into the new Drupal 8 way. We used Drupal Console to help us understand the basic boiler-plate code and create meaningful, useful code quickly.
They say Twig is great to use in Drupal 8
The answer to this statement is, yes it is wonderful and so easy to use. Here at Purencool Digital we have decided that the lead initiative of Twig needs chocolate and flowers for adding this to Drupal 8. It has removed the complexity of the TPL layer giving the developer more control and cleaner html for SEO purposes. Some examples of ease of development are
- The ease of debugging the template
- An ability to add Bootstrap classes and semantic structure anywhere
- Easy access to the render array
- The kint() function is amazing
- I could go on and on..
The debugging for the template layer was also a treat but turning it on in Drupal 8 can be a little tricky the first time, but all in all it has made site configuration much easier. Even the template hinting is great. Again, thankyou and if you lived in Australia we would mail you the chocolates.
To synchronise or use features in Drupal 8 Development
Boy, this is a hard one mainly because we thought synchronise was similar to features in D7 and we had been using them for so long that this concept is not completely foreign but is different enough that it is easy to get wrong. We found the use of this new feature great but knowing where to put it was a challenge because there is no real clear Drupal standard.
Another issue we found is when the synchronisation is out it can at times not work the way you expect but really that was understanding conceptually how it works. As we are moving forward with the migration from Drupal 7 to Drupal 8 we are finding it quite a 'developer friendly' environment.
So, the verdict, is Drupal 8 development really that great?
The answer is unreservedly yes, once you get over the new conceptual ideas that have been baked into Drupal 8. The ease from which we were able to upgrade from Drupal 7 to Drupal 8 and the use of the new theme layer to develop in Drupal 8 was duly noted. The hard decisions that were made with this upgrade are beneficial for anyone undertaking Drupal 8 development, no matter if you're a front end, backend or configuration developer, yes, you are going to love the new Kool-aid which is Drupal 8.