Coding Standards in Drupal
CourseContributing to Drupal
TopicAs an open source project, Drupal depends on community contributions in many forms including documentation, code, translation, speaking, organizing events, mentoring others, and even donating money.
The Drupal Community
TopicDrupal has an amazing community of people who create the software and help each other make the best use of it. This is one of the main benefits of using Drupal — and everyone should take advantage of that.
Layouts
TopicA layout can describe how various components are arranged on various levels—from an entire page from the header to the footer, to just the “middle” where the dynamic content goes, to individual components. It can apply to templates for managed content or one-off designs for landing pages.
Development environments provide a sandbox where you can work on your application without affecting the live site.
Back up Your Drupal Site
TopicA reliable backup will allow you to restore your site if something goes wrong.
JavaScript in Drupal
TopicJavaScript files are included by a module or a theme by creating an asset library. Using this asset library system you can selectively choose which files to load, overwrite existing files, or customize them to suit your needs.
Drush
TopicDrush is a command line interface that enables you to interact with your Drupal site without clicking around the graphical user interface (GUI).
PhpStorm
TopicThe PhpStorm integrated development environment (IDE) contains dozens of useful features that make working with a Drupal codebase easier.
Hooks
TopicHooks allow modules to alter and extend the behavior of Drupal core, or another module. As a Drupal developer, understanding how to implement and invoke hooks is essential.
Blocks
TopicA block is a reusable widget that is placed inside regions (layout containers) of your theme. Blocks can be used by site administrators on the Block layout admin page or provided by a module using the Plugin API.
In this exercise you will demonstrate that you understand the CSS patterns used for smaller elements of Drupal such as fields, and can create selectors which override them appropriately. You will also override template files to create your own markup and suggest new template files.
In this exercise you will demonstrate your ability to attach JavaScript to themes, and use Drupal behaviors to enhance the functionality of a website.
In this exercise you will demonstrate that you understand the concept of responsive CSS and the methods which can be used to implement it in a Drupal theme.
In this exercise you will demonstrate your ability to create a custom theme as a subtheme based on Zen and use Sass.
This exercise will have you demonstrate an understanding of Drupal themes and how to develop CSS to theme the default markup created by Drupal, with particular reference to CSS naming conventions.
This tutorial teaches you everything you need to know about using the tutorials on Drupalize.Me.
Installing Drupal using the instructions in this tutorial will give you a working Drupal site that can be used for learning, or real-world project development.
Before you can work on a Drupal site locally (on your computer), you'll need to set up a local development environment. This includes all the system requirements like PHP and a web server, that Drupal needs in order to run. Our favorite way to accomplish this is using DDEV.
In this tutorial we'll learn:
- How to install and configure DDEV for use with a Drupal project.
- How to use DDEV's integrated Composer to download Drupal and Drush.
- How to install Drupal inside DDEV so you can access the site and start doing development.
By the end of this tutorial, you should be able to set up a local development environment for learning Drupal or working on a new Drupal project.
Standardized documentation is crucial to a project, whether it is just you or an entire team working on it. In this tutorial we're going to look at:
- Standards for
@docblock
comments - Standards for inline comments
- Why standards for documentation and comments are as important as standards for the rest of your code.
By the end of this tutorial you'll know how to add inline documentation for all the PHP code that you write for Drupal.