I have a bespoke Content Type pertaining to venues. These are not user-creatable; they are all created from importing a trusted third-party feed, which sanitised the titles before they come to me (so there's no risk of XSS or SQL Injection here). The titles might, however, contain accented characters (é
, ô
etc), apostrophes ('
) or ampersands (&
); these are coming out as HTML escapes (so '
instead of an apostrophe, &
instead of an ampersand, etc).
The Content Type Venue
has a field title
, which is a Node module element, so doesn't allow me to mess with its display settings. In the Node template page, I can use substitutions in the display of this title
, but I can't work out how to make it be the raw text version. The title
is currently set to display as %node:title
and I tried using %node:title:raw
and %node:title-raw
in case one of those would magically work, but they had no effect.
I saw something that looks like a potential solution at Custom HTML in Drupal Node Titles on zerotodrupal.posterous.com, which attaches to the hooks hook_preprocess_page
and hook_preprocess_node
, creating a new method like
function hhhdarkelegance_custom_title($node) {
return check_markup(strip_tags($node->title, '<em><em>'));
}
but, while that blog post looks like it will work well for named HTML tags, I'm not sure it will necessarily deal with HTML entities, which are what my problem is here. I suppose I could do the opposite to the blog-post code and replace out &
to &
before display, but that feels really kludgy and, frankly, it would be nice to be able to do this just using a substitution, if possible.
Is there some way of achieving this that doesn't involve cutting code? If so, is strip_tags
what is causing the HTML escapes? (The function description reads as though it's only causing the removal of HTML tags, which I am fine with either way — they won't occur in my node titles. I am wanting to stop escaping the HTML escapes, however.)
So how can I (on a specific Content Type, without worrying about security concerns) prevent Node titles from rendering HTML escape characters to the usual and just write the damn output to the page?
I did scan through several pages of similar-looking questions before posting and I couldn't find one that addressed this, so my apologies if someone has asked this already; if you point me towards it I'll be suitably embarrassed and try even harder next time. Thanks for your help, everyone!