In one of the earlier posts featured What does a Drupal Developer do? We discussed about the role in general and how Drupal developers fit into different profiles.
We also spoke about the Skills a Drupal developer should have. In this post I will mention some of the things I have missed in the previous articles with the main focus being resources.
Learning to be a Drupal developer
This is not a very difficult task but you should know how. Know that Google is your best friend. I tell this to every newbie I see seeking help from seniors. You know what they do that you don’t? They know how to Google and yep that’s a thing. Of course they know a lot more than you do but there comes a moment even with the best developers when they look outside for answers.
What you should do?
You will need to learn to Google. Use keywords period. You want to know “How to build Drupal theme using Bootstrap” don’t type the whole thing on Google, instead type “build Drupal theme using Bootstrap” cut out those extras and use only the keywords.
Where to look?
Drupal.org is the best place to find a ton of material to begin with and of course there are various other websites, books and podcasts.
Technology
Modern PHP programming
What you should know
Programming patterns
Factory methods
Dependency injection
Namespaces & PSR-0
Modern Object-Oriented PHP
Classes, objects, inheritance
Late static binding
Drupal 7 and its predecessors had basic procedural PHP programming mostly except for Drupal core, hook patterns and a few APIs would suffice but with the introduction of modern concepts of PHP in Drupal 8, you are required to work with advanced OOP patterns and syntax.
Resources
Design Patterns of Drupal, Larry Garfield,
The MVC Pattern and PHP, Callum Hopkins
What is Dependency Injection, Fabien Potencier
PHP Objects, Patterns and Practice (Third Edition), Matt Zandstra
Symfony
What you should know
Symfony2 components form the basis for D8
Drupal 8 doesn’t work like Symfony2
Drupal 8 and Symfony2 share PHP libraries, knowing Symfony2 will help you learn Drupal8 better, of course these two individually solve different issues but there are a few things knowing which will help you to be a better developer. The Symfony website is the best place to learn about it. You should know about EventDispatcher, HttpKernel and HttpFoundation, ClassLoader, YAML, Routing, DependencyInjection, Twig, Process, Serializer, Validator, Translator.
Resources
New 3rd Party libraries
Guzzle – for fetching content from URLs (replaced drupal_http_request)
EasyRDF – for parsing RDF into PHP
Zend_Feed – for processing Feeds
Composer
What you should know
What is Composer and how does it work
When do you need to use it
Composer is a dependency management tool for PHP used by Drupal 8 to handle its PHP dependencies, such as Symfony and Twig. composer.json is available at /composer.json, which follows a schema to define the version dependencies for each package.
It helps with handling dependencies and subsidiary dependencies with locating, downloading, validating, and loading said packages, while ensuring that exactly the right versions for each package is use.
Resources
PHPUnit
What you should know
Simpletest is replaced with PHPUnit, more or less
Learn to use PHPUnit
The testing framework PHPUnit has been added to Drupal 8. Simpletest is still supported but should only be used for web tests and DrupalUnitTest's that require a complete or partial Drupal environment.
PHPUnit is the de-facto standard tool to write (unit) tests in PHP and offers a long list of advantages over Simpletest, such as overall better API's, Mocking, an improved test runner, code coverage report generation and more.
Resources
Drupal
Plugins
What you should know
How to find, create, load and work with Plugin’s
Plugins are small pieces of functionality that are swappable. Plugins that perform similar functionality are of the same plugin type. These are useful for extending or modifying both core and contrib behaviour. They offer more flexible architecture and make it easy to customise Drupal in a way that is also flexible.
Some terms you’ll need to be familiar with:
Plugin types
Plugin discovery
Plugin factory
Plugin derivatives
Discovery decorators
Plugin mappers
Resources
Entity API
What you should know
Entities are Classed objects with a defined Interface
Fields are bound to entities, and no longer shared across bundles
How to access entity properties and fields
How to define new Entities
Drupal 8 introduces a more feature rich entity API with full CRUD support in core. Entity forms have also been introduced to simplify the creation and management of entity forms.
Entities are now classed objects that implement the Drupal\Core\Entity\EntityInterface.
The default implementation is the Drupal\Core\Entity\Entity class.
Entity create, update, and delete functionality is now provided via the interface.
Users, nodes, comments, files, taxonomy terms and vocabularies have been converted to extend the new base class and interface.
entity_uri() and entity_label() have been removed in favor of methods.
The Entity API in Drupal 7 was limited. Drupal 8 expands it heavily in order to provide better tools and flexibility for working with entities.
Resources
Configuration API & Configuration entities
What you should know
How to load and save config data
Creating and working with Config Entities
How config data is managed
variable_get() and variable_set() are gone
The configuration API provides a central place for modules to store configuration data. This can be simple static data like your site name, or configuration for more complex business objects like field definitions or image styles. Contrib module developers can commit YAML files in a module/config folder defining the structure of their configuration settings.
In addition, Drupal 8 gets config entities, which are like regular entities only they are used for configuration – not content – and are not fieldable, and use the Config API for storage, not the database.
Resources
Understanding Drupal 8’s config entities, Lee Rowlands
Routes
What you should know
How to write Symfony2 routes
In Drupal 8 we are using the Symfony2 Routing component, so we are able to split out the route handling aspect, and get a much improved and feature-rich solution. For example, this allows us to have multiple routes based on Accept headers, enabling RESTful web services.
Resources
Using Drupal 8’s new route controllers, Kim Pepper
Controlling Access to Drupal 8 Routes with Access Checks, Kim Pepper
Services
What you should know
Many Drupal functions are now “Services”
What are Services and how do they work
Accessing and injecting Services
A Service is any PHP object that performs some sort of "global" task. Each service is used throughout your application whenever you need the specific functionality it provides.
A Service Container (or dependency injection container) is just a PHP object that manages the instantiation of services (i.e. objects).
In Drupal 8, we use the Symfony Service Container component, and Services are defined in YAML files. One example is the Drupal::moduleHandler() service, which replaces a lot of functions dealing with module management.
Resources
Introducing the Symfony Service Container, Fabien Potencier
Object-oriented forms
What you should know
Forms are now objects, built from a common interface
Extend \Drupal\Core\Form\FormBase for common form functionality
In Drupal 7, forms were built by a procedural function, and validation and submission were provided by magically named functions: the name of your form building function, followed by either _validate or _submit.
In Drupal 8, there is now an interface called FormInterface. It has four methods:
getFormID()
buildForm()
validateForm()
submitForm()
The form is called in mostly the same way as before, using drupal_get_form(), or via a route, however now we pass the class name instead.
Resources
Drupal 7 and 8 are different in a lot of ways and while I was writing this article one of my colleagues pointed me to the list about changes in the versions.
I owe it to all these people for this article,