Errata

  • Chapter 1: page 15 : Disabling Unneeded Modules

    Description of Erratum

  • The book instructs you to disable the Color and Overlay modules. At press time, disabling the Color module left the Slate color in tact. However, Drupal has changed and this is no longer the case. Now it reverts to the default blue color.

  • Recommended Correction

  • In order to keep your site looking the way it should, you should leave the Color module enabled. Go ahead and disable the Overlay module as instructed.

  • Wrong field selected in View setup

    Description of Erratum

  • Item #7 under the 'Building the Authors Headshot View' section contains an error - it says to choose 'Content: Image' as one of the fields, when actually it should be 'Content: Headshot'.

  • Recommended Correction

  • 'Content: Headshot' instead of 'Content: Image'

  • Unclear item in ordered list / View configuration

    Description of Erratum

  • Item #1 in the ordered list begins: "Go back to the profile view image display..." I don't understand what this is trying to say.

  • Recommended Correction

  • I honestly don't know. I've been stuck on this page for about 30 minutes, and still can't figure out what that sentence is supposed to mean.

  • Erroneous View Page Display Elements

    Description of Erratum

  • Contrary to the instructions on this page, there is no option to format the View as "Row style: Node (teaser)". No "Node" options whatsoever are available.

    Similarly, there is no option to filter by "Node: Type = Profile" or "Node: Published = Yes".

    There is also no available option to sort by "Fields: field_pagecount."

  • Recommended Correction

  • I think maybe someone was thinking of Drupal 6 when writing this section? Under filtering, "Content: Published (Yes)" and "Content: Type (= Author profile)" are valid choices. For the formatting override, "Show: Content | Teaser" should work. And for the sort criteria, I used "Content: Approximate pages (field_pages)."

  • Missing steps

    Description of Erratum

  • Figure 8-21 shows setting the display options on the Chapter content type and shows several fields the chapter never told you to create. Figure 8-18 does the same. I know the book isn't supposed to detail every single step but I ran into problems when I tried to figure out how to follow here and would have appreciated some instruction. For example one of the fields not described is Internal name and this field is referenced on this page where you are told to enter a value into it when you create your first Chapter.

  • Recommended Correction

  • Give instructions for creating the additional fields.

  • $invocation->modules needs unserialize for empty() to work

    Description of Erratum

  • You mention that you caught missing unserialize() in a different place. $invocation->modules is "a:0{}"; so empty() doesn't produce the right result unless you wrap it in unserialize here as well.

  • Recommended Correction


  • if (unserialize(empty($invocation->modules))) {
    $modules_text = t('None');
    }

  • Reverting features in update hooks requires a helper function

    Description of Erratum

  • The tip on page 258 (Chapter 13, Putting a site online and deploying new features) does not work. The Features revert command needs some helper code wrapping around it, called straight it will fail.

  • Recommended Correction

  • The solution is to steal some code from Drush until Features makes a utility function available. A good place for this code is in the .install file of a custom installation profile for your site (or a master feature) because that is where all site-related updates, such as reverting Features, should go. This would be appropriately named for an example.install file, rename the function from example to the name of the .install file you are reverting features from.

    <?php
    /**
     * Revert specified features.
     *
     * @TODO Check that it really is Forced features revert.  Currently an exact
     * copy of the function initially placed in feature_projects.install.
     *
     * Code mostly taken from drush.
     */
    function sdl_features_revert($modules) {
     
    module_load_include('inc', 'features', 'features.export');
     
    features_include();

      foreach (

    $modules as $module) {
        if ((
    $feature = feature_load($module, TRUE)) && module_exists($module)) {
         
    $components = array();
         
    // Forcefully revert all components of a feature.
         
    foreach (array_keys($feature->info['features']) as $component) {
            if (
    features_hook($component, 'features_revert')) {
             
    $components[] = $component;
            }
          }
        }
        foreach (
    $components as $component) {
         
    features_revert(array($module => array($component)));
        }
      }
    }
    ?>

    Use would be from hook_update_N() functions and look like:

    <?php
    /**
     * Implements hook_update_N().
     *
     * Revert all content-related features, necessary for using correct view mode.
     */
    function example_update_7005() {
     
    sdl_features_revert(array('feature_about', 'feature_awards', 'feature_events', 'feature_news', 'feature_people', 'feature_projects', 'feature_frontend'));
    }
    ?>

    Remember do not use closing PHP (?>) tags in your Drupal files (except templates).

  • Unable to override theme_more_link - Drupal 7

    Description of Erratum

  • I followed the instructions provided in the book, but when I clear my cache nothing changes. I have attempted to code the code from another template and still have the same issue. I have attempted to Google a solution but I have as of yet to find a solution.

    <?php
    /**
    * Overrides theme_more_link().
    * - Changed the text from "More" to "Show me More"
    * - Changed the class from "more-link" to "more"
    */
    function dgd7_more_link($variables) {
    return '<div class="more">' . l(t('Show me MORE!'), $variables['url'], array('attributes' => array('title' => $variables['title']))) . '</div>';
    }
  • Incorrect index in array of region names

    Description of Erratum

  • The code listings defining the array of regions (Pgs. 288, 291) have an incorrect index which causes Drupal to spit out the message
    Notice: Undefined index: highlighted in include() (line 121 of /var/www/html/drupal/sites/all/themes/dgd7/page.tpl.php).

  • Recommended Correction

  • Change regions[highlight] to regions[highlighted] in the .info file for your theme.

  • The word question is repeated

    Description of Erratum

  • At the bottom of the page, in the Note it says "See additional material and ask question questions about..."

  • Recommended Correction

  • Delete the word "question."

  • Theme and Module Implementations, Listing 16-6

    Description of Erratum

  • The code comment accompanying the example template_preprocess_hook function is incorrect in specifying implementing template_process_hook.

  • Recommended Correction

  • Update the code comment to reflect the correction hook implementation:

    /**
    * Implements template_preprocess_node().
    */
  • Implementing theme_contact_site_form()

    Description of Erratum

  • listing 16-29: The code doesn't seem to be working at all. I'm working on Linux (Ubuntu); there is the code here:
    <?php
    /**
    * Implements theme_contact_site_form().
    */
    function dgd7_contact_site_form($variables) {
    // Hide the subject field. It's not required.
    hide($variables['form']['subject']);
    // Change the labels of the "name" and "mail" textfields.
    $variables['form']['name']['#title'] = t('Name');
    $variables['form']['mail']['#title'] = t('E-mail');
    // Create output any way you want.
    $output = '';
    $output .= ''. t("We'd love hear from you. Expect to hear back from us in 1-2 business days.") .'';
    $output .= render($variables['form']['name']);
    $output .= render($variables['form']['mail']);
    $output .= '';
    // Be sure to include a rendered version of the remaining form items.
    $output .= drupal_render_children($variables['form']);
    // Return the output.
    return $output;
    }

  • Recommended Correction

  • I can't figure out what's wrong with it. Any ideas? Many thanks for responses.

  • hook_theme() Implementation for Using Templates with Forms

    Description of Erratum

  • The code in listing 16-30 doesn't seem to be working at all. I'm working on Linux(Ubuntu). There is the code here:
    <?php
    /**
    * Implements hook_theme().
    */
    function mytheme_theme() {
    return array(
    'contact_site_form' => array(
    'render element' => 'form',
    'path' => drupal_get_path('theme', 'mytheme') . '/templates',
    'template' => 'contact-site-form',
    ),
    );
    }

  • Recommended Correction

  • I've got no idea.

  • Author meant class instead of id

    Description of Erratum

  • On line 3:

    //add the jQuery UI dialog to all elements with id of dialog

    ...author meant class, not id - sorry Jake! :)

  • Recommended Correction

  • //add the jQuery UI dialog to all elements with class of dialog

  • Wrong jQueryUI for the draggable example

    Description of Erratum

  • Wrong jQueryUI for the draggable example.

  • Recommended Correction

  • - drupal_add_library('system', 'ui.dialog);
    + drupal_add_library('system', 'ui.draggable');

  • Wrong jQueryUI for the droppable example

    Description of Erratum

  • Wrong jQueryUI for the droppable example

  • Recommended Correction

  • - drupal_add_library('system', 'ui.dialog);
    + drupal_add_library('system', 'ui.droppable');

  • Typo in git example

    Description of Erratum

  • In my printing of the book the example for git init reads...

    it init
  • Recommended Correction

  • git init

  • broken link

    Description of Erratum

  • (near bottom of page)
    "With a debugger (see dgd7.org/ide), you can try to watch all the functions..."
    (The requested page "dgd7.org/ide" could not be found.)

  • Recommended Correction

  • fix link
    got stuck at this point in reading the chapter

  • Example code doesn't work

    Description of Erratum

  • theme('xray_help', array('text' => $output));
    Does not return anything, and therefore causes function _xray_help_admin_appearance() to return nothing as well, generating no help text. (at least in drupal 7.9).

  • Recommended Correction

  • I have no idea 8).

  • Grep Issue

    Description of Erratum

  • grep -nHR --include=*.module 'View site reports' modules

    I am using the MINGW32 Git Bash command line tool in Windows Vista. The above command produces the following errors:

    grep: invalid option -- R
    grep: unrecognized option '--include=*.module'

  • Recommended Correction

  • To correct this issue I ran:
    grep -nHr 'View site reports' modules
    (note the lowercase r).

    Hope this is helpful to somebody!

  • Minor Typo

    Description of Erratum

  • Under "Figuring Out Your Data Model" -- paragraph three, sentence one:

    The code that gather shook information, ...

  • Recommended Correction

  • This sentence should read:

    The code that gathers hook information, ...

  • small grammar error

    Description of Erratum

  • The second paragraph under the "Enable" section states:
    "Drupal will not allow you to enable a module if all dependencies are not present in your site files.",
    which means if none of the dependencies are present. While this is true, the text should read:
    "Drupal will not allow you to enable a module if not all dependencies are present in your site files."

  • Recommended Correction

  • fix grammar.

  • Download Drupal, then change directory, not other way around

    Description of Erratum

  • In the instructions for rapidly downloading a test installation, the cd (change directory) command must follow the downloading of Drupal into the directory of that name.

  • Recommended Correction

  • cd ~/workspace
    drush dl drupal --drupal-project-rename=formmsgs
    cd formmsgs
    drush si --db-url=mysql://root:rootpass@localhost/formmsgs

    Where "formmsgs" is the name used for your test site.

  • typo

    Description of Erratum

  • "... and massaging you Views using this ..." should read
    "... and massaging your Views using this ...".

  • Recommended Correction

  • add 'r'.

  • typo

    Description of Erratum

  • First bullet point should say "Name: The name of the display of ..."
    It currently says, "Name: The same of the display of ..."

  • Recommended Correction

  • change 's' to 'n'

  • "User: Name" not a valid filter criteria

    Description of Erratum

  • The instructions for creating a filter to limit the content to articles written by Bob is written as follows: "Select User from the Filter select box and select the User: Name filter from the list."

    In my 7.10 installation of Drupal I don't see "User" as a choice in the Filter select box. I ended up using "Author uid" as the filter criteria. Perhaps I don't have the necessary module installed or enabled or perhaps Drupal changed this along the way.

  • "Wrap field in HTML" should be "Customize field and...

    Description of Erratum

  • The paragraph describing how to modify the output of a field, incorrectly specifies "Wrap field in HTML". As of Drupal 7.9, the checkbox is labeled "Customize field and label wrapper HTML".
    Additionally, the diagram below those directions does not show the "Customize field HTML" or "Customize label HTML" checkboxes.

  • Recommended Correction

  • update text and diagram accordingly.

  • Instruction's "Add and Configure" button does not...

    Description of Erratum

  • The directions for handling zero results specify to click "Add and Configure". The only buttons are "Apply" and "Cancel".

  • Recommended Correction

  • Change directions to "and then Apply".

  • Using tabs for Unique Displays

    Description of Erratum

  • The method described does not work. It produces a page with tabs, all of which point to the same URL (eg /?q=content), resulting in the same content displayed no matter what tab you choose. The expected result would be for the tabs to lead to a different URL (eg /?q=content/blog) and display different content (eg the blog posts).

  • Recommended Correction

  • This tutorial http://tewson.com/content/creating-tabbed-views-drupal-6 seems to work for Drupal 7 as well.

  • unquoted words are confusing

    Description of Erratum

  • "Click Before under Attachment position"... It sounds like I need to click something before doing something else.

  • Recommended Correction

  • Use quotes:

    Click "Before" under "Attachment Position" and change this to "After".

  • Reference to 'Event' content type

    Description of Erratum

  • Page 79 refers to an "Event" content type, but there is no such content type.

  • Recommended Correction

  • Add a short section telling the user to create an Event content type, or to install whatever module provides it.

    (And fix this "Create Erratum" form -- I got a cryptic error because typed the chapter number; I had to look at the other errata before I realized that this form wants the chapter *title*, not the chapter *number*.)

  • Recommended place to put Drush aliases file is kept a secret

    Description of Erratum

  • In the section "Drush Aliases for All Sites Involved in the Upgrade", a location at which the shown aliases file can be placed so that Drush will read it was not mentioned.

  • Recommended Correction

  • The recommended location is in a .drush folder in your home folder:

    ~/.drush/anjali.aliases.drushrc.php

    Other places drushrc files can be placed are covered in the chapter on Drush and, as mentioned in Drush's README.txt file, in example.aliases.drushrc.php.

  • Commit message for Diff module could be more clear

    Description of Erratum

  • The git commit message
    git commit -m "Diff module for helping show differences between features and content."
    would be clearer as

  • Recommended Correction

  • git commit -m "Diff module shows differences between default and overridden features and between revisions of content."

    (Also, ignore the smart quotes some not-so-smart copy editor used in the code.)

  • "Hexadecimal" misspelled

    Description of Erratum

  • In the description of the Color module, "hexidecimal" should be "hexadecimal".

  • Formatting error

    Description of Erratum

  • The description of the User module and the introductory paragraph for the next set of core modules are formatted as a single bulleted paragraph, and the list of modules that follow (from Aggregator onward) are indented an extra level, giving the false impression that they're subsidiary to the User module.

  • Recommended Correction

  • Split the description of the User module after the first sentence and correct the indentation, as follows:

    • User - manages the user recommendation and login system.

    Drupal provides still more modules in core that are not enabled by default in the Standard installation profile. You may consider enabling the following modules according to your site's functional requirements:

    • Aggregator - allows you to import RSS feeds into your Drupal site (...)
  • browser'' should be browser's

    Description of Erratum

  • The description of Pathauto has a double apostrophe after the word browser. The line should be "... in the browser's address bar."

  • Incorrect use of possessive "URL's"

    Description of Erratum

  • In the text about the Token module, the possessive "URL's" is used instead of the plural "URLs".

  • Recommended Correction

  • Remove the apostrophe so it reads "search engine-friendly URLs".

  • Chapters in book and on site do not line up

    Description of Erratum

  • Chapter 19 "Using Drupal's APIs in a module" and Chapter 20 "Refining your module" (probably among others) are not valid "chapters" in this errata submission form.

  • Recommended Correction

  • Fix your form.

  • Drupal.behaviors attach not working

    Description of Erratum

  • I can't get the wrapping style that is recommended in the book to fire the jQuery:

    Drupal.behaviors.myNameSpace = {
      attach: function(context, settings) { 
        $('.selector').interaction();
      }
    };
  • Recommended Correction

  • This wrapping style is working for me:

    (function($){
      $(function() {
        $('.selector').interaction();
      }
    )})(jQuery);

    I assume this is just me.

Subscribe to Errata