0

Added the following through code:

// $uri = custompath?type=All&field_id=2&storage=3 

$secondary_links['menu_custom_item'] = array(  
                      'attributes' => array( 'title' => $label ),
                      'alter'   => 1,
                      'href'    => $uri,
                      'title'   => $label,
                      'language'  => 'en' 
                );

Why is it that when drupal renders the link the URL it links to is something like: http://mydomain.ca/custompath%3Ftype%3DAll%2526field_id%3D2%2526storage%3D201110

Literally it links like that and obviously returns Page Not Found. As soon as I manually change the %'s in the path we're good again. Is there a way to prevent this? Do I need to deconstruct the URI and pass the variables in one by one?

2 Answers 2

0

Try using urlencode ...

$secondary_links['menu_custom_item'] = array(  
                      'attributes' => array( 'title' => $label ),
                      'alter'   => 1,
                      'href'    => urlencode($uri),
                      'title'   => $label,
                      'language'  => 'en' 
                );
0
0

Resolved. Had to do with how the url() function works in Drupal. Because I was passing the href in a way that Drupal considered it an 'internal' path - the query string was not being processed correctly. Resolved by turning href in my code to an absolute link so Drupal views it as external.

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.