1

I have created a custom page at admin/structure/pages and have set the path to be

course-details/%id/%name

My intention is that there will be a custom block appearing on this page and the id and the name, in the URI, will pass data to the custom block. I have the block working fine and it is pulling data from a test page URI as expected. I now need to embed this block onto the course-details page, which contains content that must appear for any hit on this page regardless of the id and name.

In the settings => arguments for this page I have set the two arguments to be strings

In settings => access I have set "all criteria must pass"

When I hit the page with no id or name I see the course-details page, at this stage I do not have the custom block enabled, and I am seeing the content that must appear on all course-details pages.

However when I add the id and name, an example is as follows

course-details/ACM20110-01V03/certificate-ii-in-animal-studies

I am getting a 404 error. It seems the id and name are causing me trouble.

I have spent hours hunting on Google for trying to get my head around why this is not working. I am probably doing something silly.

Could anyone please help with this issue.

2 Answers 2

0

By using the named wildcards %id and %name as wildcards, Drupal will look for functions named id_load() and name_load(). It will pass the values of these wildcards to those functions, and use the return values as the arguments passed to the page callback. If the _load functions are not found, or if a FALSE value is returned, or no value is returned, you will get the error you are seeing.

I'm suspecting you want your path to be:

course-details/%/%
0

Here is an expansion on Jaypans answer and why your item isn't working:

hook_menu wildcard auto-loader for webform submission?

Each argument in this case will be just % - and it will be up to your page callback function to convert those arguments into objects. Though, as strings, that seems a bit tricky and perhaps unreliable but I don't know enough about your application.

I am guessing you are also using something like Page Manager since you did not include a hook_menu definition..

1
  • I am using the Drupal admin page manager for this as I wanted to keep it simple Commented Jan 13, 2017 at 2:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.