Best Method of Handling Repeated Content Within Existing Fields? We are trying to find the best solution for handling repeated content within existing Fields in the CMS.

That is, there are bits of information which could be used nearly anywhere within existing fields in the CMS (e.g. inside a Plain Text field / Rich Text field etc) (things like the event booking link, booking deadline, event start date etc etc). The ideal solution would be that these bits of information are housed in one place in the CMS (probably will be a global), and can cleanly be pulled through to other areas of the CMS with a super user-friendly bit of syntax.

-

We've explored a few options, namely the following...

Reference Tags

As these are limited to Plain Text field types, these are not an option.

Globals

As per this SE question.

This would involve having to add include(template_from_string()) almost everywhere where a content is output from the CMS, which would be a pain and also the syntax might be a little confusing for the end user.

Create our own plugin

Whilst this might mean the syntax could be a bit more user friendly (e.g. something like [main-event-dates], we would still have to pass every field output to the plugin (i.e. craft.myPlugin.parseSyntax(entry.body)

Events

I'm just starting exploring Hooks and Events, and this looks like the best solution so far to me. From my understanding, the approach which would be most suitable for us would be something like this:

myPluginPlugin.php

function init() {
    craft()-&gt;on('elements.onPopulateElement', function(Event $event) {
        craft()-&gt;myPlugin_main-&gt;parseSyntax($event);
    });
}   


myPlugin_MainService.php

function parseSyntax($event) {
    // Parse the content of the fields, using something like the following
    $event-&gt;params['element']-&gt;getContent();
}


Considerations with using the 'Events' method


We would need to build in a mechanism of programatically clearing all template caches when one of those bits of central information is changed (as Craft will not be aware of which templates need their cache clearing)
Is there a risk that this will be super php intensive to essentially loop though each field for each bit entry model / matrix block model etc etc?


-

Does anyone know of a better way to achieve what we are trying to achieve? Or feel strongly any way about any of the above?
Forgive me but after re-reading everyone's input, I lean towards Moto_Nomad relationships suggestion, mostly because it will make life as easy as possible for the content-administrator.

In your latest comment you write:


  ...but the issue is not about relating entries, but smaller bits of information, for which there is not a prescribed location.


Q: Could you give us an example of a 'smaller bit of information', please?


  That is, there are bits of information which could be used nearly anywhere within the CMS (things like the event booking link, booking deadline, event start date etc etc)


I'd suggest that the 'smaller bits of information' as well as the info you mention above, which are relevant to a Festival/Event should be stored within those (Event) Entries. 

Especially if these 'bits of info' are updated over time i.e. from from one event to the next.

(I'll avoid going into an explanation of the Entries field type) 

;)


  The ideal solution would be that these bits of information are housed in one place in the CMS (probably will be a global), and can cleanly be pulled through to other areas of the CMS with a super user-friendly bit of syntax.


Check out this thread: Is it possible to use Twig in a Rich Text Field?

I realise the above is about the Front-End but thought it might be useful.

Let us know how you get on, Mike :)