Errata (Second Edition)

This page lists the errors found in the book.

Chapter 8. The Theme System, Page 188

Location on the page: 
Code example at top
Chapter: 
8. The Theme System
Error: 

print theme('links', $secondary_links, array('class' => 'links primary-links'))

Correction: 

print theme('links', $secondary_links, array('class' => 'links secondary-links'))

Description of the Error: 

The class set for the secondary links is 'links primary-links', buth should probably be 'links secondary-links'. Thanks to Johan Falk for reporting the error.

Chapter 8. The Theme System, Page 190

Location on the page: 
upper middle
Chapter: 
8. The Theme System
Error: 

On page 189 the $picture variable is described. It is also discribed differently in the same list under a seperate listing on the next page (190).

Thanks for the book. I'm learning a lot.

Chapter 8. The Theme System, Page 195

Location on the page: 
Two-thirds down the page
Chapter: 
8. The Theme System
Error: 


/**
* Implementation of hook_theme().
*/
foo_theme() {
return array(
'breadcrumb' => array(
'arguments' => array('breadcrumb' => NULL),
),
);
}

Correction: 


/**
* Implementation of hook_theme().
*/
function foo_theme() {
return array(
'breadcrumb' => array(
'arguments' => array('breadcrumb' => NULL),
),
);
}

Description of the Error: 

'function' is missing from code snippet

Chapter 8. The Theme System, Page 195

Location on the page: 
Code example
Chapter: 
8. The Theme System
Error: 


return array(
'breadcrumb' => array(
'arguments' => array ('breadcrumb' => NULL),
);
);

Correction: 


return array(
'breadcrumb' => array(
'arguments' => array('breadcrumb' => NULL),
),
);

Description of the Error: 

Semicolon following array closure should be a comma. Also, extra space after array keyword.

Chapter 9. Working with Blocks, Page 213

Location on the page: 
upper middle
Chapter: 
9. Working with Blocks
Error: 

The following line of code:
$blocks[0]['cache'] = BLOCK_NO_CACHE;

is missing from:

case 'list':
$blocks[0]['info'] = t('Pending comments');
return $blocks;

Correction: 

case 'list':
$blocks[0]['info'] = t('Pending comments');
$blocks[0]['cache'] = BLOCK_NO_CACHE;
return $blocks;

Description of the Error: 

The block cache setting is missing from the approval.module code example on page 213. Its is included in all other examples of approval.module code in the "Building a Block" section.

Chapter 10. The Form API, Page 222

Location on the page: 
The FAPI Diagram
Chapter: 
10. The Form API
Error: 

The Form API Diagram on p.222 has and incorrect flow for cached/posted forms.

Correction: 

The original diagram shows cached/posted forms re-entering the flow right before validation. Actually these forms are run through drupal_process_form() -> form_builder() regardless. (Which gives people a crack at things via #after_build before validation :) )

See http://codelica.com/misc/FAPI-diagram-corrected.jpg

[Thanks, and we've tried to get an updated diagram into the second printing. -JV]

Chapter 10. The Form API, Page 222

Location on the page: 
Bottom right - the "no" path from "redirection set"
Chapter: 
10. The Form API
Error: 

Diagram shows a path from "Redirection set" over to the left side of the page, going down to "Is #cache true".

Correction: 

After the submit function(s) are run, there is *always* a redirect. If #redirect is set, it will be to the page specified there. Otherwise, the rediirect is to this same page. In that case, the whole thing starts over again, but without "submitted" being set. The text on p. 228 seems to have this right, but it's wrong in the diagram.

Chapter 10. The Form API, Page 222

Location on the page: 
Bottom
Chapter: 
10. The Form API
Error: 

I think there is an arrow missing from Rebuild Form to the arrow leading to Render form elements

Correction: 

Add the arrow if it is realy an error

Chapter 10. The Form API, Page 222

Location on the page: 
Form API flowchart
Chapter: 
10. The Form API
Error: 

hook_form_id_alter()

Correction: 

Should be hook_form_FORM_ID_alter().

Chapter 10. The Form API, Page 223

Location on the page: 
Section "Collecting All Possible Form Element Definitions" (bottom of page)
Chapter: 
10. The Form API
Error: 

Next, element_info() is called.

Correction: 

Next, _element_info() is called.

Description of the Error: 

Incorrect function name. See http://api.drupal.org/api/function/_element_info/6 for API documentation of this function.