I am trying to create a custom token that modifies another token.
$theDomainName = "[domain-name-raw]"; //Pull in the other token
$removeCounty = str_replace(" County", "", $theDomainName); //Replace " County" with nothing
$countyPlus = str_replace(" ", "+", $removeCounty); //Replace " " with "+"
return $countyPlus; //Return modified token as new custom token to be used through out site
If I use [domain-name-raw] for $theDomainName
, my result is the original token (e.g. "Cerro Gordo County"). If I type what [domain-name-raw] should output for $theDomainName
(e.g. "Cerro Gordo County"), my code works fine (it outputs "Cerro+Gordo"). What is going on?
I am using Drupal 6.