0

I have a path controlled by page manager & domain access selection rules.

Let's say I'm on the Main (US) version of the page, and I need to know of the spanish version of the page is valid.

/contact-us

/es/contact-us

I've tried things like drupal_valid_path, drupal_lookup_path, etc.

The only option I've found is to do something like menu_get_item() Then hack the global language, call the callback from menu_get_item with

//hack global language here      
$router_item = menu_get_item($path);
$page_callback_result = call_user_func_array($router_item['page_callback'], $router_item['page_arguments']);
if (MENU_NOT_FOUND != $page_callback_result) {
   //url is not valid
}
//set global language back to original

Is there a simpler more generic way to programmatically do this? If there were some function like drupal_valid_path that would just say if the path results in 404 or not, that would be great, though I haven't found something like that yet.

-1

We use the Link Checker modules on our sites. This would scan all links and give a report back as to which are broken, if any. I don't see any reason why this would not work on any site, including multi lingual.

Whether or not you use the module, you should be able to look at the code to get an idea of what functions and logic it's using to create similar functionality, if you're looking to do it programmatically.

  • This doesn't answer the question, I'm asking for a programmatic way of doing this on the fly. – CCMonkey Mar 18 '14 at 22:44
  • You didn't say either way. Perhaps you can make your question clearer. "Is there a simpler, more generic way?" The way you have it written suggests that you may be unaware of current modules that may solve the problem and thus you're trying to achieve it programmatically. – blue928 Mar 18 '14 at 22:55
  • Question has been modified. – CCMonkey Mar 18 '14 at 22:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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