Building a traditionally "coupled" Drupal site provides us with a lot of functionality we've so far taken for granted when building our simple blog.
This lesson attempts to remedy some of that by: building a functional pager and a post archive.
We'll also make our blog into an actual Single Page Application (or SPA) by using the client-side router provided by Backbone.js
Self-check challenge: Add a form with select list elements that filter posts (instead of relying on the sidebar links).
Additional resources
One of the historic complaints—and drawbacks—of client-side Javascript applications is that they aren't SEO-friendly. While Google's crawler, in particular, is starting to execute Javascript on pages it indexes, in this tutorial, we'll take a look at a couple other of methods of mitigating this issue.
In particular we'll learn about:
- Prerender.io
- What is Isomorphic Javascript?
- Writing a server with Express.js
Self-check question: In addition to SEO, what are some other benefits of isomorphic javascript?
Additional resources
Prerender.io
Express.js
What is an isomorphic application? — by Juampy NR on Lullabot.com
PhpStorm has a Drupal plugin you can add to your IDE. In this tutorial you will learn how to configure the Drupal plugin and which new special features it provides, such as code generation, code completion, knowledge of Drupal coding standards, and more.
For more information about using PhpStorm with Drupal 8 and Symfony, read PhpStorm’s Symfony2-specific features for Drupal 8 tutorial from JetBrains.
Additional resources
Please note that this series covers PhpStorm versions 6 and 7 only.
For the latest documentation (including up-to-date videos), see JetBrains documentation.
Coding Standards in Drupal
CourseDevelop Drupal Sites
GuideStandardized 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.
Formatting standards cover things like the use of whitespace, how to format control structures, and other aspects that affect your code's appearance and format.
In this tutorial we’ll talk specifically about standards regarding formatting. This is by no means an exhaustive list of PHP syntax rules, but rather is focused on formatting standards for Drupal.
By the end of this tutorial you'll know about the most common Drupal code formatting standards as well as where to find more information when questions arise.
Translations have their own special functions in both Drupal 7 and 8, and there are some rules for standardizing how they are used that make things clearer for everyone.
In this tutorial we'll look at:
- When to use, and when not to use, translation utilities to output translatable strings
- How placeholders work in translatable strings
- Tips for creating links inside of translatable strings
By the end of this tutorial you should know when, and how, to make strings in your code translatable using Drupal's translation utility functions.
Once you know what code standards are and why you should use them, you need to learn how to implement Drupal coding standards in your projects. This tutorial will walk through some of the steps you can take to make this as easy as possible. We'll cover:
- Configuring your editor or IDE to warn you of coding standards violations
- Setting up the Coder module and phpcs to scan and review your code
- Performing team code reviews
By the end of this tutorial you should be able to configure your development environment and implement processes in your workflow that help to ensure your code meets Drupal's coding standards guidelines.
Drupal core uses object-oriented programming (OOP). This method of programming introduces new coding standards to the project. In this tutorial we'll cover the Drupal coding standards that relate to object-oriented PHP code.
By the end of this tutorial you should know how to implement the Drupal coding standards related to OOP, and where to find more information when you've got questions about the standards.
Before you dive into using coding standards it makes sense to understand exactly what they are and why they’re important, generally and specifically in the Drupal community. In this tutorial we will look at:
- What coding standards are
- Why following coding standards is a good idea
- Where coding standards come from
By the end of this tutorial you'll have a better understanding of what coding standards are, and why you should be adhering to them when you write code.
Today's Drupal developer needs more than just a text editor and FTP. Best practice Drupal development involves a suite of tools, processes, and more than one server environment.
This tutorial is directed toward an audience that is not familiar with best practices in Drupal Development and methods involving version control with Git, IDEs, local development environments, and deployment environments (i.e. stage, live). Here we're providing a high-level overview of these topics with links to dive deeper if you need more information.
In this tutorial, we'll cover:
- Introduce Version Control Systems such as Git
- Discuss how Git can be used to deploy to remote web servers
- Review programming-centric text editors and Integrated Development Environments
- Identify the need for a local development environment.
- Explain shared deployment environments including production and stage.
Create a custom module and alter the content on a node page using a hook and existing theme functions.
Identify and use preprocessors by creating a custom breadcrumb trail on a page, and reduce and refactor code in custom modules.
Create a new module for movie imports, which will display a form when the user navigates to a page.
Make SQL queries in Drupal, make HTTP requests to external websites, and use this data to validate a form.
Use a form submit hook to pass information down the form API and create a node programmatically.
Create an image file programmatically and attach a file to a node.
Check and create taxonomy terms programmatically.