0

we would like to habe a node type only for side wide available values. We think we have a title and a 'value' field. When we need one of these values in text areas/fields we would like to type [title_of_the_node] and in the output we get the value of the value field displayed.

Does anyone know a solution for this?

0

Have you looked at the Token API? With the API one can define custom tokens. The functions you should look at are:

With hook_token_info() you define new tokens. In your case you could retrieve all nodes of your configureation node type (with an EntityFieldQuery for example), loop over the entries and create a token for each of them.

In hook tokens you define what your tokens are replaced with - just load the node entity for the given token and retrieve the content of your value field.

Here is a tutorial I found useful when writing some custom tokens a while back: http://www.fredparke.com/blog/create-your-own-tokens-drupal-7

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.