Detailed Look at the Path

The key added to the $items array is the string admin/emailusers/compose/%. This is the new path that we are registering and will be accessible with a URL as follows:

http://example.com/drupal/?q=admin/emailusers/compose/1. (On hosts that have mod_rewrite support enabled, the ?q= could be omitted.)

Unlike the path we registered in the last chapter, this one uses a placeholder in the path. This placeholder is denoted by the percent sign (%). The placeholder indicates to Drupal that an additional (unspecified) argument is expected at the end of the path.

As the menu system interprets this path, the path is composed of four elements: admin, emailusers, compose, and whatever value is passed as %. It assigns each an integer value, starting with 0 (for admin), and ending with 3 (for the value of %).

The % wildcard requires that some parameter value be passed. That space cannot be left empty. For example, if the browser requested a URL with the query string q=admin/emailusers/compose, the menu item above would not be invoked. Since there is no value to replace %, Drupal will not match the paths.

In our module, the % placeholder should be filled with a User ID, which is the unique integer that identifies a user. We will use this placeholder to find out to what user the mail should be sent.

Was this article helpful?

0 0

Post a comment