Part 1: Make the link work without javascript
In this example we have a table listing log entries of some kind. We want to put a delete link against each log entry allowing the administrator to delete the log entry:
The following code is responsible for printing out each link onto the page:
$query = array(
'tok' => drupal_get_token('delete_log_item' . $flid),
) + drupal_get_destination();
$output[] = l(t('Delete'), 'admin/my-custom-log/delete/' . $flid, array('query' => $query));
The callback of which is defined by the following hook_menu item:
$items['admin/my-custom-log/delete/%'] = array(
'page callback' => 'my_custom_log_entry_delete',
'page arguments' => array(3),
'access arguments' => array('permission name')...