Something like [node:field_category] in the argument field.

some of these terms are multiword.
I've tested this across two sites I'm working on.
When it has to deal with a MULTIWORD term, custom_pagers breaks. either custom_pagers vanishes, or it reverts to the next result in the view ignoring the argument, which sometimes takes you to another node thats not in the right category.

I'm using this to page through nodes in a category.
What I want...
Visit category 1 landing page, go in to a node for category 1, be able to page NEXT / PREV between nodes ONLY IN THAT CATEGORY.

What I'm getting is that if the node has a multi-word term in it, CUSTOM PAGER can't deal with the token [node:field_category].

Comments

alphex’s picture

Hey look at that.
I fixed it.
Now I have to go make a patch for this.

//custom_pagers.module line 309
// Get arguments for the view.
if (!empty($pager->args)) {
	$args = explode("\n", $pager->args);
	foreach($args as &$arg) {
		$arg = token_replace(trim($arg), array('node' => $node));
	}
}
else {
	$args = array();
}

Replace the above code, with what I have below. Yes its ghetto, but I fixed my problem.
Anyone see a fault with it? I'm interested in doing it correct.

// Get arguments for the view.
if (!empty($pager->args)) {
	$args = explode("\n", $pager->args);
	//print "args:".$args;
	foreach($args as &$arg) {
		$arg = token_replace(trim($arg), array('node' => $node));
		$arg = strtolower($arg);
		$arg = preg_replace("/[^a-z0-9_\s-]/", "", $arg);
		$arg = preg_replace("/[\s-]+/", " ", $arg);
		$arg = preg_replace("/[\s_]/", "-", $arg);				
		//print "<br />!arg:".$arg;
	}
}
else {
	$args = array();
}

... obviously you can remove my PRINT statements, that I used for debugging.
I'll work on rolling a patch this weekend.

danlinn’s picture

A little late to this party, but I thought I'd ask if you used the term name contextual filter in a view for this? If so, you'd be able to use the "Convert spaces to dashes" option which would solve the problem I think you're having.