0

So i have set up a page view which has the path about/% with % representing the argument used in that view. I now want to link to this page on the main navigation bar.

I created a menu item about/%dest but that didnt work as i guess the route is already registered by the view? so i altered it to look like this:

$items['%dest/about']= array(
  'page callback' => '_bps_path_redirect',
  'page_arguments' => 'about',
  'title' => 'about',
  'title callback' => 'get_title',
  'access arguments' => array('access content'),
  'type' => MENU_NORMAL_ITEM,
  'menu_name' => 'main-menu',
);

function dest_to_arg() {
  $arg = arg(1);
  return $arg;
}

function _bps_path_redirect($arg) {
  drupal_goto($arg.'/'.arg(1));
}

But to no success, the redirect doesn't work. So am i missing something? Is there a simple way to link a view which has a wildcard in its path?

0

Solved. I modified the page views to use a static path and then set up a contextual argument to grab the parameter of the url to use as an argument.

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.