Drupal 7 hook menu validating argument from url

Rated 3.85/5 based on 581 customer reviews

One standard approach to integrating data from outside sources is to use a RESTful endpoint to accept JSON data.

There are several contributed options to accepting JSON POST, but you may find a custom option best fits your needs.

FYI: the behavior you are seeing is how Drupal's menu system is designed.

The number corresponds to each argument being passed to the menu.

If an integer is used as an argument it will represent a part of the URL, starting from 0, incremented once for each slash (/).

In Drupal 6, you’ll have to visit the modules page.

In Drupal 7, it seems to be enough to clear all caches (you may have to run cron as well).

For example "title callback" would also let you use a function to change the page title based on the presence of the query parameter in the same manner as the page callback.

For access control, it's probably better to return MENU_ACCESS_DENIED or MENU_NOT_FOUND from your page callback.

Leave a Reply