2

Lets say i have a node with a body like:

" Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc cursus dapibus diam sit amet aliquet. "

I'm looking for a way to convert the consectetur (for example) word into a link to another node, when the node is displayed (and not when is edited!)

What is the best practices to define what node shuld be linked to that word (taxonomy? cck field?), and how to do that (theme_preprocess_node?).

Please note that, whatever hook/theme function i can use, the results must be cached (until the node get edited again): the site is for a no-profit cultural association with the lowest budget i've ever seen ;)

0

I think the Glossary module does what you need?

You define a taxonomy and it will scan the text and provide links to the terms when a node is displayed.

0

I would definitely use taxonomy for the relation between node and word, I would then use hook_node_save to alter the value of the body and add the links with a preg_replace. By adding a specific class to those links you can then remove those links with hook_form_alter before the body field is displayed for editing.

0

If you are looking for a Drupal 7 alternative, then the Glossify module is the way to go for this.

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.