#label_prefix and #label_suffix

Created on 20 August 2008, almost 16 years ago
Updated 11 May 2024, about 1 month ago

I would like to make a small request to the forms API, I would like to have the ability to use label prefix and suffix on all elements that have labels.

Example:

$form['mail'] = array(	
    '#type' => 'textfield',
    '#title' => t('E-mail'),
    '#required' => TRUE,
    '#label_prefix' => '<div>Labelprefix',
    '#label_suffix' => 'Labelsuffix</div>',
    '#field_prefix' => 'Fieldprefix',
    '#field_suffix' => 'Fieldsuffix',
}

At the moment the forms API allows you to insert #field_prefix and #field_suffix, but those are only in front of or after the themed textfield.

My request would make the HTML for a textfield to look something like this:

Fieldprefix<div>Labelprefix<label>E-mail</label>Labelsuffix</div>
<input ....>Fieldsuffix
✨ Feature request
Status

Closed: won't fix

Version

7.0 ⚰️

Component
FormΒ  β†’

Last updated about 5 hours ago

Created by

πŸ‡ΈπŸ‡ͺSweden MiMe

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024