By dww on
Apologies for the missing examples in the first edition of the newsletter. We even tested it, but the revision simplenews sent out wasn't the one we intended.
EXAMPLE - BEFORE API CHANGE:
$items['admin/content/animals/cat'] = array(
'title' => 'Cat',
'page callback' => 'drupal_get_form',
'page arguments' => array('animal_form', $type),
'access arguments' => array('administer animals'),
'file' => 'animal.admin.inc',
'type' => MENU_CALLBACK,
);
$items['admin/content/animals/cat/edit'] = array(
'title' => 'Edit',
'type' => MENU_DEFAULT_LOCAL_TASK,
);
$items['admin/content/animals/cat/delete'] = array(
'title' => 'Delete',
'page arguments' => array('animal_delete_confirm', 'cat'),
'file' => 'animal.admin.inc',
'type' => MENU_CALLBACK,
);
$items['animals/%user_current'] = array(
'title' => 'Animal list',
'page callback' => 'animal_list',
'page arguments' => array(1),
'access arguments' => array('view animals')
);
EXAMPLE - AFTER API CHANGE (note changes to 3rd item with added 'access arguments' and 4th item with switch to '%user_link'):
$items['admin/content/animals/cat'] = array(
'title' => 'Cat',
'page callback' => 'drupal_get_form',
'page arguments' => array('animal_form', $type),
'access arguments' => array('administer animals'),
'file' => 'animal.admin.inc',
'type' => MENU_CALLBACK,
);
$items['admin/content/animals/cat/edit'] = array(
'title' => 'Edit',
'type' => MENU_DEFAULT_LOCAL_TASK,
);
$items['admin/content/animals/cat/delete'] = array(
'title' => 'Delete',
'page arguments' => array('animal_delete_confirm', 'cat'),
// We must now define the access parameters here too.
'access arguments' => array('administer animals'),
'file' => 'animal.admin.inc',
'type' => MENU_CALLBACK,
);
// Switched to using %user_uid_optional.
$items['animals/%user_uid_optional'] = array(
'title' => 'Animal list',
'page callback' => 'animal_list',
'page arguments' => array(1),
'access arguments' => array('view animals')
);