Score:0

Inserting tags into plain text fields

do flag

I've been given a content type with content already populated.

There are a number of headings/title fields in the content type and I have been asked to style a sub-section of those fields.

ie:

<h1>Title for your local service is styled</h1>

has to become:

<h1>Title for your <span class="myclass">local service</span> is styled</h1>

or something like that.

Is there a way to insert span tags like this into plain text fields? Maybe with a token?

I would like to avoid changing all such fields to formated text fields if possible. Not to mention I've been asked to do this for the node Title which I don't think I can recreate in such a way.

I can add the span to the WYSIWYG editor but would like someway to do this in the plain text fields.

Score:1
cn flag

If you add a span tag to a plain text field, it will be output as text, not a tag-- that's why it's a "plain text" field.

If you want your text to be formatted, use a formatted text field.

If the requirements have changed and a field which used to contain plain text now needs to have HTML tags, the field type needs to change, too.

Handling the title

For the node title, there may be some hacky way to add the tags, but I would not try that. Instead, add another field such as Formatted page title to the content type(s) and then put the formatted title there.

The Title is also to print the <title> of the page, which does not support HTML tags, and having metatags there will also mess up Metatags and other modules using such info. So if you want a formatted title, that is best as a separate field.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.