I have a site with a range of products. In order to ensure an easy input for the content editor and a consistent look throughout the site, I thought I'd make an input filter that would replace any occurrence of
with a link to the node presenting the product (product-name == product code here). On output, this would be changed into, say:
<a href="products/product-name" class="product product-product-name">Real [product-name]</a>
However, I have doubts as per the efficiency side of such a solution, namely because - product-name would have to be a value of a field on the content type. Thus, for each replacement, Drupal would have to comb through all nodes, load each of them and perform a test to find a match. Quite database-intensive as I imagine.
So another thought was to provide a custom token. But would that change anything? Would it work within text fields, or would I have to use hook_node_view_alter to invoke the replacements?
What would be your strategy to provide this kind of tokens?