Errata (Third Edition)
This page lists the errors found in the book.
14
Sat, 01/15/2011 - 11:01am — Oreamnosconfigure=admin/config/content/annotate/settings
configure=admin/config/annotate/settings
Links to the wrong page.
14
Fri, 06/17/2011 - 12:55pm — cinly.ooiLast sentence of page 14 says "Begin the file with an opening PHP tag and a CVS identification tag, followed by a comment".
Should be ''Begin the file with an opening PHP tag, followed by a comment"
Last sentence on page 14 says 'Begin the file with an opening PHP tag and a CVS identification tag, followed by a comment' . However, the relevant code on page 15 (top code section) does not have the CVS tag. In the second edition, we have the CVS tag $Id$.
As Drupal moved away from CVS, I believe the code segment is correct, but the sentence is wrong. Not the other way round.
18
Tue, 01/04/2011 - 11:55pm — fndtn357return system_settings_form($form);
return system_settings_form($form, TRUE);
missing argument
20
Sat, 01/15/2011 - 4:51pm — Oreamnosfield_delete_instance($instance);
field_delete_instance($instance, false);
If the function field_delete_instance() is called without the second parameter being set to false, the annotation field (table) is deleted when 0 content types are checked on the Annotations config page. Therefore, when you check 1 or more content types later, you get the following error message:
FieldException: Attempt to create an instance of a field annotation that doesn't exist or is currently inactive. in field_create_instance() (line 455 of /Users/Eric/Sites/Dev/ProD7Dev/modules/field/field.crud.inc).
Line 452 - 456 of field.crud.inc
function field_create_instance($instance) {
$field = field_read_field($instance['field_name']);
if (empty($field)) {
throw new FieldException(t("Attempt to create an instance of a field @field_name that doesn't exist or is currently inactive.", array('@field_name' => $instance['field_name'])));
}
Line 736 - 759 of field.crud.inc
function field_delete_instance($instance, $field_cleanup = TRUE) {
.
.
.
.
.
// Delete the field itself if we just deleted its last instance.
if ($field_cleanup && count($field['bundles']) == 0) {
field_delete_field($field['field_name']);
}
}
21
Wed, 10/19/2011 - 5:59am — christyjohnI will then use the node_get_types() API
I will then use the node_type_get_types() API
The node_get_types() function is not available in Drupal 7
26
Wed, 05/11/2011 - 10:02pm — sconnallThe last sentence reads:
or by using the “Clear cached data” button
It should read:
or by using the “Clear all caches” button
The button "Clear cached data" was changed to "Clear all caches" in Drupal 7.
34
Fri, 01/07/2011 - 8:33am — Oreamnosfunction beep_user(&$edit, $account) {
function beep_user_login(&$edit, $account) {
Not a proper implementation of hook_user_login().
42
Fri, 02/18/2011 - 1:47am — austin-loves-drupalThe screenshot in Figure 3.4 is of the wrong overlay. (What is shown in Figure 3.4 is not available until an instance of the advanced action has been created as described on pp. 43-44 and in Figure 3.5.)
What should be shown in Figure 3.4 is the overlay accessed by clicking the Configuration link in the top menu and then clicking on the Actions link in the Configuration page, and finally scrolling to the bottom of the overlay to the "Create an Advanced Action" drop-down select box.
42
Fri, 02/18/2011 - 1:51am — austin-loves-drupalAdminister-> Site configuration-> Actions
Configuration->Actions
The navigation instructions are slightly incorrect-- they appear to be for Drupal 6.
43
Tue, 01/11/2011 - 1:10pm — Studiewegif (!is_int($beeps))
if (!is_numeric($beeps))
the is_int function can't read the string stored through the form, use is_numeric instead
64
Sat, 01/15/2011 - 3:54am — ifernandoThe Greetings menu should not appear in the figures as this is a MENU_CALLBACK. The Greetings title also does not appear (at least in my Drupal it says "Home").
Please note that on page 68 MENU_CALLBACK is replaced by MENU_NORMAL_ITEM and from here onwards the menu item should appear.
67
Sat, 01/15/2011 - 4:10am — ifernandoThis code does not receive the URL arguments
To receive the URL arguments it should be something like:
function menufun_hello($first_name='', $last_name='', $first_arg='', $second_arg='') {
$replace = array(
'@first_name' => $first_name,
'@last_name' => $last_name,
'@first_arg' => $first_arg,
'@second_arg' => $second_arg,
);
return t('Hello @first_name @last_name from Menu Fun with arguments @first_arg, @second_arg', $replace);
}
74
Wed, 02/16/2011 - 12:16pm — jjkieschdrupal_set_title overrides the page title on every page.
drupal_set_title should be in the page callback, not the title callback.
I just moved the line that sets the title to menufun_hello and now it only overrides the title for that page.
77
Sat, 01/15/2011 - 3:38pm — ifernandouser_view() does not exist
Probably, it refers to user_view_page()
79
Sat, 01/15/2011 - 3:42pm — ifernando%index is not explained anywhere
80
Sat, 01/15/2011 - 3:40pm — ifernandoThe 'logout' menu path does not exist in Drupal 7
In Drupal 7 the right path is $items['user/logout']
80
Tue, 03/06/2012 - 9:18pm — Lucothe code
function menufun_hello($animal) {
return t(“Hello $animal”);
}
doesn't fetch the argument for the return() statement.
also the quotation marks used here cause errors on copy and paste.
function menufun_hello($animal) {
return t(
'Hello @animal!',
array(
'@animal' => $animal
)
);
}
as seen on the bottom of page 64, the t() function requires @something and then an array stating that @something is the key and $something is the value.
81
Sat, 01/15/2011 - 3:45pm — ifernandoThe way to execute the logout hook is incorrect.
In Drupal 7 the logout hook is named hook_user_logout(). Therefore, the invocation should be module_invoke_all('user_logout', $user).
85
Thu, 01/20/2011 - 6:46pm — CrazedLemmingThe code example for "Displaying Menu Items as Tabs" results in multiple instances of the following error message:
Warning: Invalid argument supplied for foreach() in menu_unserialize()
Changing all instances of "access arguments" with "access callback" seems to fix it.
85
Fri, 05/13/2011 - 8:07pm — sconnallMilkshake menu is not displayed and the following warning appears:
Warning: Invalid argument supplied for foreach() in menu_unserialize()
Changing all instances of "access arguments" with "access callback", as suggested in previous errata, got rid of the error message(s) but the menu still did not appear. I downloaded the source zip from the Apress website and applied the corrections from the "missingSource/Chapter_04_source" folder and everything works fine now.
Change each of your 'access arguments' (not 'access callbacks'), as follows:
'access arguments' => array('list flavors'),
with the exception of 'milkshake/add', which should be changed to:
'access arguments' => array('add flavor'),
107
Sat, 05/14/2011 - 11:32am — sconnallSeveral of the datatype sizes in the MySQL column (first column) are split making them difficult to read at first glance.
Remove the spaces in the type sizes.
128
Mon, 05/16/2011 - 6:01pm — sconnallParse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting ')' in <Your Drupal 7.x install location>/sites/all/modules/custom/loginhistory/loginhistory.install on line 29
Single quote needs to be added to the 'uid' key in function loginhistory_schema().
'uid' => array('uid),
Insert single quote at end of 2nd uid:
'uid' => array('uid'),
133
Tue, 07/19/2011 - 5:26pm — bvirtual$account->uid, 'module' => 'authdave');
$account->uid, ':module' => 'authdave');
Added missing colon : in front of the array key value so the SQL will correctly substitute. Also, trivially, removed a space from each of the double spaces surrounding the quoted key value.
134
Mon, 03/28/2011 - 7:36pm — m4olivei$uid = db_insert('users')->...
$uid = db_insert('authmap')->...
The last box in the flow chart states the final step in the external login: insert into the authmap table.
