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.
Hello
i use entity reference view widget it return only checkbox not all informations defined in config. It works fine with another theme. i dont know why it doesnt work with bootstrap theme.
function bootstrap_form_element return $build without teste if existe field_prefix or field_suffix
suggestion
// Build the form element.
$build['element'] = array(
'#markup' => $element['#children'],
'#prefix' => !empty($prefix) ? $prefix : NULL,
'#suffix' => !empty($suffix) ? $suffix : NULL,
);
}else{
if(!empty($element['#field_suffix'])) {
$build['element']['#suffix'] = $element['#field_suffix'];
}
if(!empty($element['#field_prefix'])) {
$build['element']['#prefix'] = $element['#field_prefix'];
}
}
Comment | File | Size | Author |
---|---|---|---|
#6 | Screenshot from 2016-01-27 12-20-31.png | 11.06 KB | gge |
Comments
Comment #2
lazzyvn CreditAttribution: lazzyvn commentedComment #3
markhalliwellThis issue queue isn't for support or debugging integration with other modules. Not all modules are supported out-of-the-box. Most of the time, the issue is with the module itself rather than the theme (despite it working in other, "core", themes) due to how they implement core APIs (or lack thereof).
Comment #4
lazzyvn CreditAttribution: lazzyvn commentedbecause bootstrap theme dont support #field_suffix
i have to modify theme boostrap
/themes/bootstrap/templates/system/form-element.func.php
function bootstrap_form_element(&$variables)
and note when you update version
Comment #5
lazzyvn CreditAttribution: lazzyvn commentedi dont understand why bootstrap function bootstrap_form_element does not support #field_suffix ? it is very helpful for another hook
Comment #6
gge CreditAttribution: gge commentedI modified form-element.func.php as @lazzyvn mentioned but I think this needs a bit more attention...
Expected html output:
The actual html output:
Comment #7
lazzyvn CreditAttribution: lazzyvn commentedit will create 2 input checkbox? when you want output only label (title)? don't have it I use Display the rendered entity and i set view mode with field i want show it. I will check it again
Comment #8
gge CreditAttribution: gge commentedSorry, it seems that 2 labels are created on node add/edit form and 1 checkbox.
To simplify it, instead of
I get this
Comment #9
markhalliwellComment #10
thlo7777 CreditAttribution: thlo7777 commentedI tried add field_suffix and field_prefix in bootstrap/templates/system/form-element-label.func.php. That is ok for me. Please help me to review it if it's correct. Thanks a lot :) Bootstrap theme version 7.x-3.5
Comment #11
vlooivlerke CreditAttribution: vlooivlerke commented@thlo7777 Your solution did not work for me, It created duplicate form fields if you use a placeholder.
this worked for me
I modified form-element.func.php
Comment #12
code38 CreditAttribution: code38 commentedsame problem for me and the modification from @vlooivlerke in form-element.func.php solve the problem.
thanks a lot.
Comment #13
titouilleLike gge, the output is inverted:
instead of
If you read the comment in bootstrap_form_element :
important think is "render the input element inside the label". So #field_prefix and/or #field_suffix must be added to label key, not element key:
In order to have a correct display. For entityreference_view_widget, #field_suffix is not included in label directly, but at least the position is correct (after the checkbox).
Comment #14
aqmaster CreditAttribution: aqmaster commentedThank you so much. @titouille this worked for me. (Y)
Comment #15
thlo7777 CreditAttribution: thlo7777 commentedThank you @vlooivlerke and @titouille. Your solution save my time
Comment #16
pinueve CreditAttribution: pinueve commentedanother solution look here: https://www.drupal.org/node/2524296#comment-12050849