Posted by seb7 on September 14, 2010 at 12:45pm
2 followers
Jump to:
| Project: | Custom Tokens |
| Version: | 6.x-1.2 |
| Component: | Documentation |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
| Issue tags: | autopath |
Issue Summary
Hi,
Thanks for the module.
How can i return strings with slashes ? catalogue/canne-carnassiers/baitcasting for example.
My custom token is used with pathauto
When i return this value it outputs cataloguecanne-carnassiersbaitcasting.
The problem may be related to autopath, but what should i return for autopath to deal with slashes ?
Comments
#1
ok,
it's because pathauto acts not the way on tokens depending on their name.
So to return string with slashes, the token name must end with -path.
I suggest you add that information somewhere appropriate (readmefile or ...)
#2
The patch suggested in issue #1196420: Token options are not passed to the evaluated code and the returned value type should not be string only allows to check if the 'pathauto' key is present in the
$optionsarray, so the custom PHP code may return an array of elements instead of a string when$options['pathauto']is not empty.When returning an array of string variables, the pathauto module will join them using a slash (/).
Example of use:
$test = array('path', 'to', 'my', 'content');return !empty($options['pathauto']) ? $test : implode('/', $test);
With that it is no more required for the custom token name to finish with -path.