PacktLib: Drupal 7 Development by Example Beginner’s Guide

Drupal 7 Development by Example

Credits

About the Author

About the Reviewers

www.PacktPub.com

Preface

Getting Set up

Installing an Apache, MySQL, and PHP stack

Time for action — — downloading the latest version of MAMP

Time for action — — downloading the latest version of XAMPP

Time for action — — modifying php.ini settings

Time for action — — modifying the MySQL my.cnf settings

Time for action — creating an empty MySQL database

Installing Git

Time for action — installing Git for Mac OS X

Time for action — installing Git for Windows

Installing Drush

Time for action — installing Drush for Mac OS X

Time for action — installing Drush for Windows

Installing Drupal 7

Time for action — installing Drupal 7

Installing the Aptana Studio IDE

Time for action — installing the Aptana IDE

Time for action — creating a new Aptana Studio PHP project

Time for action — setting up the Drupal content type associations

Time for action — installing the Drupal-specific Aptana formatter profile

Drupal.org from a developer's perspective

Summary

Custom Content Types and an Introduction to Module Development

Creating custom Recipe content type

Time for action — creating a custom Recipe content type

Developing a custom module

Time for action — developing a custom module

Quick introduction to Views

Time for action — installing the Views module

Time for action — creating a recipe block listing with Views

Introducing the Devel module

Time for action — installing the Devel Generate content module

Time for action — generating content with the devel_generate module

Summary

HTML5 Integration for Drupal 7 and More Module Development

First things first—changing our DOCTYPE

Time for action — installing the HTML5 Tools module

HTML5, RDFa, and Microdata

Time for action — installing the Microdata module

Time for action — configuring Microdata for our Recipe content type

Time for action — creating issues in Contrib modules' issue queues

Time for action — adding Microdata mappings for Recipe number_integer fields

NutritionInformation module

Time for action — developing a custom module for a compound NutritionInformation field

Time for action — updating the Recipe content type to use the NutritionInformation field

Summary

Introduction to Drupal 7 Theme Development

Creating a sub-theme

Time for action — installing a base theme

Time for action — creating a sub-theme and setting it as our default theme

Time for action — creating a sub-theme and setting as default theme with Drush

Time for action — configuring our Omega-based sub-theme

Manage the display for a content type

Time for action — using the Manage Display page to update the display of our custom Recipe content type

Drupal 7 Render Arrays

Time for action — implementing hook_preprocess_node

An introduction to the Drupal 7 field group module

Time for action — creating the wrapper with display suite

Summary

Enhancing the Content Author's User Experience

Developing a custom block for adding content

Time for action — developing a custom block for adding recipes

Introduction to the WYSIWYG module

Time for action — installing and configuring the Wysiwyg module

Time for action — deleting all Devel-generated recipe content

Time for action — adding my Cannellini Cumin Chicken Chili recipe

Developing a custom contenteditable module

Time for action — developing an HTML5 contenteditable module

Summary

Adding Media to our Site

Introduction to the Media module

Time for action — using Drush to install a dev version of the Media module

Time for action — adding a Media field to our Recipe content type

Custom image styles and inline Media for WYSIWYG

Time for action — adding a custom image style through the image styles administrative page

Time for action — creating a programmatic custom image style

Time for action — configuring Media-based images to use our custom small image style for our Recipe content type

Time for action — configuring WYSIWYG inline Media for the basic page content type

Integrating the Colorbox and Media modules

Time for action — installing the Colorbox module

Time for action — checking out the Colobrbox File sandbox project with Git, and testing it with the latest Media module

Time for action — applying and testing the patch for the Colorbox File module

Summary

How Does it Taste — Getting Feedback

Introduction to the Drupal contact form

Time for action — enabling and configuring the core contact form

Adding descriptive help text to our contact form

Time for action — adding help text to our site contact form

Time for action — creating a contact form with help text, with the Webform module

A more in-depth look at the Webform module

Time for action — using hook_form_FORM_ID_alter to modify our Webform-based contact form

Time for action — using hook_form_BASE_FORM_ID_alter to make our Webform emailfield code more generic

Time for another recipe

Colorbox File enhancements

Time for action — enhancing the Colorbox File module with field-based captions

Rating recipes with Fivestar

Time for action — installing and configuring the Fivestar module

Time for action — creating a custom Fivestar widget

Summary

Recipe Lists and More with Views

Views revisited—advanced configuration

Time for action — building a random top rated recipe block with views

Time for action — creating a cuisine vocabulary to organize recipes

Time for action — creating a Recipes by cuisine type Views block

Time for action — installing and using the Views Field View module for our Recipe by Cuisine Type View

Time for action — developing a Views style plugin for Semantic tabs

Time for another Recipe

Promoting the Colorbox File module as a full project

Time for action — installing and using the Coder module

Time for action — committing Colorbox File module changes to Drupal Git Repository

Summary

Rotating Banners and Project Promotion

Rotating banner with Views Slideshow

Time for action — installing the Views Slideshow module

Time for action — creating a custom Drush command to install the jQuery Cycle plugin

Time for action — creating a banner using the Views Slideshow module

Time for action — updating the front banner view to include a slideshow pager

Time for another recipe

Promoting a sandbox project to a full project

Time for action — implementing hook_uninstall for the Colorbox File module

Time for action — uninstalling and renaming the Colorbox File module

Time for action — promoting the Media Colorbox module to be a full project on Drupal.org

Summary

Test Your Code with SimpleTest

What is SimpleTest?

Time for another recipe

Writing our own SimpleTests

Time for action — creating a unit test case for the D7Dev duration formatter

Time for action — creating a web test case for the D7Dev duration formatter

Summary

Introduction to the Features Module and Configuration Management

Introduction to the Features module

Time for action — installing the Features module

Time for action — creating a Recipe content type feature

Time for action — updating our Recipe content type feature

Summary

Pop quiz Answers

Pop quiz Answers