Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Sometimes Drupal returns HTML entities and the function blueprint_trim_text()
doesn't check for them. In the end you could have something like <meta content="bla blu blub  " />
in your template, which will lead to a non valid document. Because the entity doesn't end properly.
To ensure that this doesn't happen, we have to decode all HTML entities. The following should do the trick:
// remove any HTML or line breaks so these don't appear in the text
$text = trim(str_replace(array("\n", "\r", "\r\n"), ' ', strip_tags(html_entity_decode($text, ENT_QUOTES, 'UTF-8'))));
Additionally I check for \r\n
which should also be replaced.
Comments
Comment #1
designerbrent CreditAttribution: designerbrent commentedThanks for this suggestion. I've committed it back to the code and it should show up in the download within 24hrs.
http://drupal.org/cvs?commit=382450
Comment #3
VisualFox CreditAttribution: VisualFox commentedHi sorry to bump this thread. This is a quick fix I needed in order to remove double quote and ensure the correct spacing between word after strip_tags have done its job. I am using the 1.x branch
It's a little ugly but fixed my problem with the meta description.
FYI: I actually didn't modify blueprint's template.php but my subtheme. I call this new function in the sub_theme_preprocess_page. If needed I can provide a working example.