You are previewing Drupal 7 Development by Example Beginner's Guide.
O'Reilly logo
Drupal 7 Development by Example Beginner's Guide

Book Description

"

Tag Line

  • A hands-on, example-driven guide to programming Drupal websites

  • Discover a number of new features for Drupal 7 through practical and interesting examples while building a fully functional recipe sharing website

  • Learn about web content management, multi-media integration, and e-commerce in Drupal 7

In Detail

Drupal is a powerful PHP content management system that allows you to build a wide variety of websites. By combining the power of HTML5, JavaScript, and CSS, you can develop and customize a fully-functional, world-class website. This book also covers some important changes from Drupal 6 to version 7, so even experienced Drupal users will find this straightforward guide useful.

Drupal 7 Development by Example Beginner’s Guide has numerous code examples that will not only introduce new Drupal 7 development concepts, but will give you the skills needed to build a world-class Drupal website. By following the development of a recipe-sharing, e-commerce site, you will quickly and easily get your own Drupal site up and running.

Starting from a solid Drupal 7development environment, this book will show you how to extend Drupal with front- end code using Ajax, jQuery, and server side PHP. In addition to learning how to integrate HTML5, the book will cover responsive web design, and cutting edge CSS3. Using the example of an e-commerce and social networking site, this book will develop your Drupal programming skills so that you will be capable of developing advanced code good enough to be shared with the Drupal community.

"

Table of Contents

  1. Drupal 7 Development by Example
    1. Drupal 7 Development by Example
    2. Credits
    3. About the Author
    4. About the Reviewers
    5. www.PacktPub.com
      1. Support files, eBooks, discount offers and more
        1. Why Subscribe?
        2. Free Access for Packt account holders
    6. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Time for action — — heading
        1. What just happened?
        2. Pop quiz — heading
        3. Have a go hero — heading
      6. Reader feedback
      7. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    7. 1. Getting Set up
      1. Installing an Apache, MySQL, and PHP stack
        1. Mac OS X AMP stack
      2. Time for action — — downloading the latest version of MAMP
        1. Windows AMP stack
      3. Time for action — — downloading the latest version of XAMPP
        1. What just happened?
        2. PHP configuration
      4. Time for action — — modifying php.ini settings
        1. MySQL configuration
      5. Time for action — — modifying the MySQL my.cnf settings
      6. Time for action — creating an empty MySQL database
        1. What just happened?
      7. Installing Git
      8. Time for action — installing Git for Mac OS X
      9. Time for action — installing Git for Windows
        1. What just happened?
      10. Installing Drush
      11. Time for action — installing Drush for Mac OS X
      12. Time for action — installing Drush for Windows
        1. What just happened?
      13. Installing Drupal 7
      14. Time for action — installing Drupal 7
        1. What just happened?
      15. Installing the Aptana Studio IDE
      16. Time for action — installing the Aptana IDE
      17. Time for action — creating a new Aptana Studio PHP project
        1. What just happened?
        2. Drupalize Aptana Studio
      18. Time for action — setting up the Drupal content type associations
      19. Time for action — installing the Drupal-specific Aptana formatter profile
        1. What just happened?
      20. Drupal.org from a developer's perspective
        1. Pop quiz — PHP and MySQL configuration for Drupal
      21. Summary
    8. 2. Custom Content Types and an Introduction to Module Development
      1. Creating custom Recipe content type
      2. Time for action — creating a custom Recipe content type
        1. What just happened?
        2. What just happened?
      3. Developing a custom module
      4. Time for action — developing a custom module
        1. What just happened?
      5. Quick introduction to Views
      6. Time for action — installing the Views module
      7. Time for action — creating a recipe block listing with Views
        1. What just happened?
      8. Introducing the Devel module
      9. Time for action — installing the Devel Generate content module
      10. Time for action — generating content with the devel_generate module
        1. What just happened?
      11. Summary
    9. 3. HTML5 Integration for Drupal 7 and More Module Development
      1. First things first—changing our DOCTYPE
      2. Time for action — installing the HTML5 Tools module
      3. HTML5, RDFa, and Microdata
      4. Time for action — installing the Microdata module
        1. What just happened?
      5. Time for action — configuring Microdata for our Recipe content type
        1. What just happened?
          1. Drupal development and the Drupal community
      6. Time for action — creating issues in Contrib modules' issue queues
        1. What just happened?
      7. Time for action — adding Microdata mappings for Recipe number_integer fields
        1. What just happened?
      8. NutritionInformation module
      9. Time for action — developing a custom module for a compound NutritionInformation field
        1. What just happened?
      10. Time for action — updating the Recipe content type to use the NutritionInformation field
      11. Summary
    10. 4. Introduction to Drupal 7 Theme Development
      1. Creating a sub-theme
      2. Time for action — installing a base theme
      3. Time for action — creating a sub-theme and setting it as our default theme
        1. What just happened?
      4. Time for action — creating a sub-theme and setting as default theme with Drush
        1. What just happened?
      5. Time for action — configuring our Omega-based sub-theme
        1. What just happened?
      6. Manage the display for a content type
      7. Time for action — using the Manage Display page to update the display of our custom Recipe content type
        1. What just happened?
      8. Drupal 7 Render Arrays
      9. Time for action — implementing hook_preprocess_node
        1. What just happened?
      10. An introduction to the Drupal 7 field group module
      11. Time for action — creating the wrapper with display suite
        1. What just happened?
      12. Summary
    11. 5. Enhancing the Content Author's User Experience
      1. Developing a custom block for adding content
      2. Time for action — developing a custom block for adding recipes
        1. What just happened?
      3. Introduction to the WYSIWYG module
      4. Time for action — installing and configuring the Wysiwyg module
        1. What just happened?
        2. A new recipe
      5. Time for action — deleting all Devel-generated recipe content
      6. Time for action — adding my Cannellini Cumin Chicken Chili recipe
      7. Developing a custom contenteditable module
      8. Time for action — developing an HTML5 contenteditable module
        1. What just happened?
      9. Summary
    12. 6. Adding Media to our Site
      1. Introduction to the Media module
        1. Working with dev versions of modules
      2. Time for action — using Drush to install a dev version of the Media module
        1. What just happened?
        2. Enhancing the Recipe content type with a Media field
      3. Time for action — adding a Media field to our Recipe content type
        1. What just happened?
        2. A new Recipe for our site
      4. Custom image styles and inline Media for WYSIWYG
        1. Creating a custom image style
      5. Time for action — adding a custom image style through the image styles administrative page
        1. What just happened?
      6. Time for action — creating a programmatic custom image style
      7. Time for action — configuring Media-based images to use our custom small image style for our Recipe content type
        1. What just happened?
        2. Inline Media with WYSIWYG
      8. Time for action — configuring WYSIWYG inline Media for the basic page content type
        1. What just happened?
      9. Integrating the Colorbox and Media modules
      10. Time for action — installing the Colorbox module
        1. What just happened?
        2. Introduction to the Colorbox File module and Drupal sandboxing
        3. Drupal developer community: Drupal sandbox
        4. Revisit the sandbox Colorbox File module
      11. Time for action — checking out the Colobrbox File sandbox project with Git, and testing it with the latest Media module
        1. What just happened?
        2. Drupal issue queues and enhancing the Colorbox File module
      12. Time for action — applying and testing the patch for the Colorbox File module
        1. What just happened?
      13. Summary
    13. 7. How Does it Taste — Getting Feedback
      1. Introduction to the Drupal contact form
      2. Time for action — enabling and configuring the core contact form
        1. What just happened?
      3. Adding descriptive help text to our contact form
        1. Using custom code to add help text to the contact form
      4. Time for action — adding help text to our site contact form
        1. What just happened?
        2. Adding contact help text with no code
      5. Time for action — creating a contact form with help text, with the Webform module
        1. What just happened?
      6. A more in-depth look at the Webform module
      7. Time for action — using hook_form_FORM_ID_alter to modify our Webform-based contact form
        1. What just happened?
      8. Time for action — using hook_form_BASE_FORM_ID_alter to make our Webform emailfield code more generic
        1. What just happened?
      9. Time for another recipe
      10. Colorbox File enhancements
      11. Time for action — enhancing the Colorbox File module with field-based captions
        1. What just happened?
      12. Rating recipes with Fivestar
      13. Time for action — installing and configuring the Fivestar module
        1. What just happened?
      14. Time for action — creating a custom Fivestar widget
        1. What just happened?
      15. Summary
    14. 8. Recipe Lists and More with Views
      1. Views revisited—advanced configuration
        1. Random top rated recipe block
      2. Time for action — building a random top rated recipe block with views
        1. What just happened?
        2. Taxonomy-based View with tabs
      3. Time for action — creating a cuisine vocabulary to organize recipes
        1. What just happened?
      4. Time for action — creating a Recipes by cuisine type Views block
        1. What just happened?
      5. Time for action — installing and using the Views Field View module for our Recipe by Cuisine Type View
        1. What just happened?
        2. Tabbed Views display
      6. Time for action — developing a Views style plugin for Semantic tabs
        1. What just happened?
      7. Time for another Recipe
      8. Promoting the Colorbox File module as a full project
        1. Introduction to the Coder module
      9. Time for action — installing and using the Coder module
        1. What just happened?
        2. Commit changes to Colorbox File sandbox
      10. Time for action — committing Colorbox File module changes to Drupal Git Repository
        1. What just happened?
      11. Summary
    15. 9. Rotating Banners and Project Promotion
      1. Rotating banner with Views Slideshow
      2. Time for action — installing the Views Slideshow module
        1. What just happened?
        2. Custom Drush commands
      3. Time for action — creating a custom Drush command to install the jQuery Cycle plugin
        1. What just happened?
        2. Creating a rotating banner with Views Slideshow
      4. Time for action — creating a banner using the Views Slideshow module
        1. What just happened?
        2. Have a go hero — creating a new image style for the images in our rotating recipe banner
        3. Enhance the appearance of our rotating banner with a pager and CSS
      5. Time for action — updating the front banner view to include a slideshow pager
        1. What just happened?
      6. Time for another recipe
      7. Promoting a sandbox project to a full project
      8. Time for action — implementing hook_uninstall for the Colorbox File module
        1. What just happened?
      9. Time for action — uninstalling and renaming the Colorbox File module
        1. What just happened?
      10. Time for action — promoting the Media Colorbox module to be a full project on Drupal.org
      11. Summary
    16. 10. Test Your Code with SimpleTest
      1. What is SimpleTest?
        1. SimpleTest in Drupal Core
          1. SimpleTest web interface
          2. Test files structure for modules
        2. The SimpleTest class
            1. The getInfo function
            2. The setUp function
            3. Test functions
            4. Test assertions
          1. Unit Testing with the Drupal SimpleTest module
          2. Functional or web testing with Drupal SimpleTest
      2. Time for another recipe
      3. Writing our own SimpleTests
      4. Time for action — creating a unit test case for the D7Dev duration formatter
        1. What just happened?
      5. Time for action — creating a web test case for the D7Dev duration formatter
        1. What just happened?
      6. Summary
    17. 11. Introduction to the Features Module and Configuration Management
      1. Introduction to the Features module
        1. Using Features to manage configuration
          1. Drupal components that can be managed with Features
            1. Features supported components
            2. Drupal components supported with additional modules
      2. Time for action — installing the Features module
        1. What just happened?
          1. Adding a new Feature
      3. Time for action — creating a Recipe content type feature
        1. What just happened?
          1. Managing updates to Feature components
      4. Time for action — updating our Recipe content type feature
        1. What just happened?
        2. Features for sharing Drupal components
      5. Summary
    18. A. Pop quiz Answers
      1. Chapter 1, Getting Set up
        1. Pop quiz — PHP and MySQL configuration for Drupal