rainlab/builder-plugin

Add support for basic markup in field labels

digitreadmedia opened this issue · 4 comments

Clients require some basic markup (bold & underline) in backend form field labels such as bold and underline to emphasize specific words inside a label (not necessarily the entire label). Currently HTML used in the lang.php file is always rendered as plain text.

@digitreadmedia can you provide an example use case with your actual text?

@LukeTowers Yes, below is an example from the lang.php file. The HTML is rendered as text.

<?php return [
    'plugin' => [
        'name' => 'Plugin Name',
        'description' => 'Plugin Description',
    ],
    'lost_stolen' => 'Any Firearms <b>lost</b> or <b>stolen</b>?',
    'idtype' => '<b>Type</b> of Identity Card',
    'membership' => '<b>Member</b> of Accredited Association?',
    'association' => '<b>Name</b> of Accredited Association',
    'typeofowner' => '<b>Type</b> of Owner',
    'section 3' => 'For <b>which</b> firearm(s) received training?',
    'section4' => 'Any <b>allegations of violence</b> in past <u>five</u> years?',
    'section5' => 'In past <u>five</u> years been <b>denied</b> a licence, permit or authorisation regarding firearm?',
    'section6' => 'In past <u>five</u> years any <b>attempts</b> of suicide, major depression, narcotic abuse, behaviour or emotional problems?',
    'section7' => 'In past <u>five</u> years <b>diagnosed or treated</b> by a medical practioner for depression, narcotic abuse, behaviour or emotional problems?',
    'section8' => 'Any experience of <b>divorce or separation</b> from an intimate partner in past <u>two</u> years?',
    'section9' => 'Any experience of <b>forced job loss</b> in past <u>two</u> years?',
    'safe' => 'Prescribed Safe <b>on</b> Premises?',
];

I believe you can have HTML in the comment property

The commentHtml property should allow HTML inside comments. This is the best place for it. The label would create problems for future maintenance because its hard to predict what will be found in them.

I hope this helps!