HTML in field label

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
ibakayoko's picture

Hello,

Need some help with Field API/Form/Entity API.

Issue: Want the html in the field label to be processed on node view/node edit/ and in drupal views.

I am currently working on a drupal site and facing one blocking issue.

I am posting here to see if i can get some ideas from the community on how i can address the issue.

I have attached some screenshot of what we have implemented.

The HTML added in the field label is not processed on display. the html tag are displayed like the rest of the label.

Content Type node ADD form

content-type-node-add-form.png

Content Type node View

content-type-node-view.png

Customer sample questions

customer-questions-original.png

customer-question-3.png

AttachmentSize
content-type-node-add-form.png293.97 KB
content-type-node-view.png413.57 KB
customer-questions-original.png129.64 KB
customer-question-3.png130.68 KB

Comments

add long description text after label field

phoang's picture

First, you cannot put the markup to field label and the field label has limit of number of character.

Looks like your field will be structure:
[field label | Question 1:]
[#field_prefix | long question text]

You need to use hook_form_alter or hook_form_FORM_ID_alter to proccess node edit form and add a "#field_prefix" element to the form.

For quick solution without any code, try this module Label help and place all the question in the Label help message

we did alter

ibakayoko's picture

we did alter https://drupal.org/project/remove_field_label_length_limit to 2048 to be able to add the long label.

Thank you for your input.

We did tried the form alter option but it was not helping on the node view and drupal views.

One of my colleague "sassafrass" suggested this module https://drupal.org/project/markup, i will go with this option.

I am still open to any suggestions.

With the markup, i will have to add a markup field for each field with HTML.
The markup field is displayed on node edit , node view and in drupal views.