I'm trying to add a bullet to a string in _preprocess_node() and am running into problems. I am using Drupal 7.

My code is as such:

if($node->type == 'contact_page'){
    $vars['content']['field_fax']['#title'] = t("F •");
    $vars['content']['field_phone']['#title'] = t("P •");

I get the literal string instead of the bullet. I've tried a bunch of things, but nothing seems to work. Am I missing something?

2 Answers 2



t("F !bullet", array("!bullet" => "•"));
t("P !bullet", array("!bullet" => "•"));

Drupal escapes any characters passed through t() function so you need to use variables like this:

  • @variable: Escaped to HTML using check_plain(). Use this as the default choice for anything displayed on a page on the site.
  • %variable: Escaped to HTML and formatted using drupal_placeholder(), which makes it display as emphasized text.
  • !variable: Inserted as is, with no sanitization or formatting. Only use this for text that has already been prepared for HTML display (for example, user-supplied text that has already been run through check_plain() previously, or is expected to contain some limited HTML tags and has already been run through filter_xss() previously).
  • i tried this and it didn't quite work.When I did: t("F !bullet", array("!bullet" => "•")); it worked, but I feel like using the special character in my code is bad practice. Commented Feb 14, 2013 at 16:30
  • maybe you can use • ? Commented Feb 15, 2013 at 15:40
  • tried that too! We changed the design rather than spend too much time on it. If I don't get the "right" answer eventually, I'm going to just accept this one as its "close enough." Commented Feb 19, 2013 at 21:27

Had the same issue and after hours of searching I finally found something that works. Try decode_entities

if($node->type == 'contact_page'){
    $vars['content']['field_fax']['#title'] = decode_entities("F •");
    $vars['content']['field_phone']['#title'] = decode_entities("P •");   
  • The reason for this problem is that the label is being passed through check_plain(), which translates characters to their HTML equivalents. So you cannot put HTML into it directly, and that's also why using the special character works OK. The decode_entities() approach is fine for avoiding having the special character as a literal in source, though it does mean it gets decoded and recoded again, which seems a bit redundant. Commented Mar 31, 2014 at 13:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.