Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Had stumbled into weird problem: Form API states that there is #title element, which is shown as <label>
in HTML. Why it is not present in Views exposed form select element?
function THEMENAME_form_views_exposed_form_alter(&$form, &$form_state) {
//dpm($form);
if ($form['#id'] == 'views-exposed-form-FORMID') {
$form['ITEMNAME']['#options']['All'] = t('My custom text');
}
}
Works well, but if I want to replace custom text with smth like:
$form['ITEMNAME']['#options']['All'] = $form['ITEMNAME']['#title'];
It does not work. dpm($form);
shows that there is no such element. So the question is:
is this a bug or there are some other ways to "extract" label?
Comment | File | Size | Author |
---|---|---|---|
Capture.PNG | 4.63 KB | PlayfulWolf |
Comments
Comment #1
MustangGB CreditAttribution: MustangGB commentedClosing this as outdated, feel free to re-open with updated details if it's still a problem in the latest release.