Optional argument in Drupal hook_menu implementation

Posted by Editorial Staff | Updated on

In this answer, We have shared optional argument in Drupal hook_menu implementation. It’s easier than you think :). Don’t set any arguments in your path and just pass them to your “page callback” function.

And the page callback function would look like this:

You can alter the page title using the following code. (Not tested, kindly let me know if it worked):


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers