Are you a developer new to Drupal? Read this...
Deeson Online present a training plan for a skilled software developer coming to Drupal for the first time
Drupal Basics
For someone not versed in Drupal at all, the Using Drupal book by O'Reilly is the best place to start. This is particularly true for developers coming from a background in which the construction of a website using web UI tools is not a familiar concept.
Once the tutorials in this book have been covered, the dev should have an excellent grounding of the basics of Drupal and should begin to understand why using the community modules are useful.
Drush
After the unpleasantness of having to use the GUI to make things, you can take a short rest and familiarise yourself with Drush – a command line tool providing a number of useful resources for administering a Drupal site:
Coder and coding standards
Now you need to make sure your code adheres to our coding standards. The Drupal project specifies its own. If you are using PHP Storm IDE then you can follow this tutorial to set it up correctly:
There is also a Drupal module which checks your code for you. So set this up and have a go:
Writing your first theme
Boostrap, sub-theming and Display Suite
It would then be advisable to look at how theming and sub-theming works with the bootstrap theme which we use here at Deeson Online:
Whilst looking at theming and sub theming with the above, it would be advisable to install the Display Suite module at the same time and understand how that works. There is reasonable documentation for this linked from the module page:
Features
Now, you've created a whole lot of stuff above that only exists in the database.... and you probably feel dirty. If not, what kind of dev are you!?
To get that stuff out of the DB and into code where it can be version controlled in Drupal 7 you need to use an add-on module called Features. Learn how to use this next:
Drupal recognise that things only existing in the database is a problem, so the Features module is an attempt to rectify it but it is far from perfect. (In Drupal 8 this is solved in a whole new way, but that's for another day!)
Must-have modules
There are a number of 'must-have' modules that all projects will have. It would be good to familiarise yourself with these now:
- pathauto - for setting automatic URL patterns for each content type on the system
- admin_menu - a better toolbar than the one shipped with Drupal. Enable admin_menu_toolbar as well after downloading this module
- admin_views - replace the standard admin pages in Drupal with ones generated by the views module
- captcha - add captcha to forms
- wysiwyg - rich text editing (follow the README file instructions after enabling, you should use the CKEditor library with this)
- date - superior date handling tools, fields and views integration
- devel - for dev environment – provides development tools. Eg in custom code try dpm($my_variable); or kpr($myvariable) for neat debugging of data
- email - provides an email field
- entity - provides superior entity api functions
- entitycache - provides better caching of entities
- entityreference - provides a field which allows one entity (eg a node) to reference another.
- field_group - group fields together on the node edit form in various ways
- globalredirect - basic redirect rules such as providing a 301 redirect from node/123 to it's aliased version
- google_analytics - easy integration with Google analytics
- link - provides a link field to easily add a hyperlink to the page
- masquerade - provides a block which allows the site admin to login as any other user of the site
- media - really good media handling (image library etc) for admins to manage their content
- module_filter - a better module management screen
- honeypot - spam protection for forms
- metatag - seo fields
- entityqueue - allows nodes to be placed and manually ordered in a queue. The queue can then be used as the basis of a carousel (via a view for example).
- redirect - allows site admin to create redirects on the site
- strongarm - allows variables in the variable table to be exported via features
- reroute_email - stops development sites sending emails to real users
- seckit - adds a bunch of best practice security options
- styleguide - provides an admin page which lists all HTML components in the current site styles, useful when reviewing them
- views - create listing pages and sql queries in the UI (this is also covered in Using Drupal)
- webform - a (reasonably) simple way of allowing content editors create questionnaires on the site
Writing your first module
Congratulations – you are now ready to write a module! The following tutorial will help with this:
What not to do
The fail module is an excellent piece of code to study as it gives a lot of commented examples of 'worst practice' in Drupal. Add it to a Drupal site with 'drush dl fail'
What to do
The examples in contrib project contain a whole load of modules which demonstrate how to use various components of the Drupal eco-system in code.
Almost all these are worth studying except entity_example unless you are feeling masochistic (the eck module provides this functionality in an easier to digest form).
Advanced concepts
If you still want more, take a look at the following modules that will help in creating more complex sites:
- context - allows functionality on the site to be determined by 'context' ie where the user is and what they are doing
- rules - allows events, conditions and actions on the site
- commerce - a superb e-commerce framework which is built with Drupal. The commerce kickstart distribution demonstrates its abilities superbly
- master - this module allows a module dependency listing per environment (dev, test, live). You can then script some of its drush commands to ensure the correct modules are enabled or disabled on each environment
- eck - The entity construction kit allows the construction of entities. Entities exist on the same level as node or taxonomy. These are data containers
- migrate - This is a developer's tool used for data migrations into Drupal
- wsif - This is a developer tool providing a best practice framework for developing web service integrations into Drupal
- behat_testing - To learn how to write functional tests for your site (other behat testing modules are available)
Other books
Some other useful books are:
- Pro Drupal 7 Development - for programming concepts
- High performance Drupal - for creating performance sites in Drupal. A good grounding in a number of other tools we use as well
- Clean Code - how to write clean code
- Clean Coder - best practice and professional development which we agree with
- PHP Security - The standard book on PHP security best practice
So there you go. Get cracking – and tell us how you get on!
Read moreAre you a developer new to Drupal? Read this...By John Ennew | 20th December 2013