Errata (Second Edition)
This page lists the errors found in the book. Help us improve this book by logging in and submitting any errors you find. In cases where errors exist in the code, they are corrected immediately in the code repository.
Chapter 7. Working with Nodes, Page 7
Fri, 11/20/2009 - 11:09am — fchow8888I build the projects as described. I downloaded the Joke content type code directly from this site, but I get the following error message in the Drupal admin console:
This version is incompatible with the 6.14 version of Drupal core.
Chapter 2. Writing a Module, Page 18
Sun, 09/07/2008 - 8:40pm — mikewhobikesvariable_get('annotate_node_types', array('story'))
variable_get('annotate_node_types', array('page'))
Default value shown is not consistent with the module's (see last line on page 19).
Chapter 2. Writing a Module, Page 18
Sat, 05/16/2009 - 11:00pm — garybetzWe're going to allow annotation of story node types by default
We're going to allow annotation of page node types by default
The code example on p 17 and the screenshot on p 19 show 'page' as the default; the one-line code example should reference 'page' too instead of 'story'.
Chapter 2. Writing a Module, Page 19
Sun, 09/07/2008 - 8:31pm — mikewhobikesAdminister > Settings > Annotate
Administer > Site Configuration > Annotate
Menu label is incorrect.
Chapter 2. Writing a Module, Page 19
Sun, 09/07/2008 - 8:42pm — mikewhobikes'annotate_nodetypes'
'annotate_node_types'
Variable is given a different name than in previous and following examples.
Chapter 2. Writing a Module, Page 20
Wed, 01/07/2009 - 11:41am — jvandykif (!in_array($node->type, $types_to_annotate)) {
if (!in_array($node->type, $types_to_annotate, TRUE)) {
Also on page 26, middle of page.
Strict mode for in_array() must be used or the if will fail and thus the annotation form would be displayed on nodes of all types, not just the types selected in Home / Administer / Node annotation. [Fixed in downloadable code.]
Chapter 2. Writing a Module, Page 23
Thu, 08/28/2008 - 9:08am — bellebriusvariable_delete('annotate_node_types');
variable_del('annotate_node_types');
Function name is incorrect.
Chapter 2. Writing a Module, Page 23
Sun, 08/31/2008 - 11:25am — chrissearleCREATE TABLE annotate (
uid int(10) NOT NULL,
nid int(10) NOT NULL,
note longtext NOT NULL,
when int(11) NOT NULL default '0',
PRIMARY KEY (uid, nid),
);
CREATE TABLE annotations (
uid int(11) NOT NULL,
nid int(11) NOT NULL,
note longtext NOT NULL,
created int(11) NOT NULL default 0,
PRIMARY KEY (uid, nid)
)
I know that the SQL is "something like" - but - having pasted it in and used schema module to cut'n'paste the code it would be better if it actually was valid SQL and matched the schema that was used.
There are two points that don't match
1) table name ("annotate" vs. "annotations")
2) column "when" is really column "created" (and "when" is a MySQL reserved word so would need quoting)
Plus - one error (at least for MySQL) - an extra comma after the PRIMARY KEY column.
Chapter 2. Writing a Module, Page 23
Sun, 09/07/2008 - 11:32pm — mikewhobikesIn the downloadable code, hook_install() is missing the line to delete the module's variable.
Update online code to include:
variable_del('annotate_node_types')
Omission from online code.
[Fixed in downloadable code. -JV]
Chapter 2. Writing a Module, Page 28
Mon, 12/22/2008 - 4:34pm — jvandykIf you're following along at home, you’ll need to clear the menu cache to see the link
appear. You can do this by truncating the cache_menu table...
If you're following along at home, you’ll need to rebuild the menu router table to see the link
appear. You can do this by visiting admin/build/modules...
In Drupal 6, clearing the menu cache is no longer enough. You must rebuild the menu_router table to get new menu entries to appear. The menu_router table is rebuilt automatically when you visit admin/build/modules, or use the devel module to rebuild it.
