1

I am attempting to add glyphicon options to titles. Is there a way I can add a field to a content type in order to render the html showing the glyphicon? I am trying to add it to just the basic page content type and the page it shows on title click.

I tried adding a select list with the inside as options for example, but it would not render the html.

EDIT:::

I tried the title html module, but it only allows a few elements. I would ideally like to add a select list to my content type that contains all the glyphicons i'd like to use on the page and i could just select which one to show before the title from that select list. It would then show the glyphicon before the title on save.

  • can you clarify the question a bit? You want to have HTML in your title fields? – jdu Apr 11 '14 at 17:19
  • @jdu Updated the question a little. – jasonflaherty Apr 11 '14 at 17:25
1

an easier way to do this will be using this module:

Icon API

1

I think you're on the right track with adding a second custom field to allow the user to choose the glyph.

Once the user has set the title, selected the glyph and saved, you can merge the two using a template file.

https://api.drupal.org/api/drupal/modules!field!theme!field.tpl.php/7

The one you'd want I think would be named something like this: field--title--basic-page.tpl.php

In there, you can stick the value of the glyph next to the title. Does that make sense?

  • I'll give that a shot. Any example code you might have? – jasonflaherty Apr 11 '14 at 18:13
  • This exact approach is going to be tricky because the title for node pages isn't rendered out in the node template (it's in the page template). – mpdonadio Apr 11 '14 at 18:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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