Closed (won't fix)
Project:
Entity Reference View Widget
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
3 Jul 2015 at 14:57 UTC
Updated:
7 Nov 2018 at 23:02 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
dotmanblue commentedThanks for the patch. This fixed the title missing issue I was having in Bootstrap.
Comment #2
m.stentaI was experiencing the same issue with Bootstrap-based theme: labels were missing entirely (see attached screenshot). This is because a) Entityreference View Widget is adding the as markup to the #field_suffix, and b) Bootstrap does a bunch of HTML alterations to make the markup better suited for the Bootstrap CSS + JS.
As far as I can tell, the only reason that the label is being added to #field_suffix is to handle the "Display the rendered entity" use-case, where the entire entity is rendered as the label, instead of just the entity title.
That means, however, that the patch above will break the "Display the rendered entity" option. Because you can't stick the whole entity into a form element title.
Attached is a new patch that conditionally adds EITHER a #title, or a #field_prefix, depending on whether or not "Display the rendered entity" is checked. So this should handle both cases gracefully.
Comment #3
muschpusch commentedEven though i'm not sure why the bootstrap theme isn't rendering the field_suffix the same problem occurs when rendering the whole entity on the field_suffix. A possible fix is to render the entity on the #title but that doesn't sound right.
Comment #4
lazzyvn commentedi have the same issue with bootstrap theme. it can't render "Display the rendered entity" when we define at field config view entityreference_view_widget can i do some modify with theme bootstrap?
I found themes/bootstrap/templates/system/form-element.func.php
bootstrap_form_element(&$variables)
this function don't add $build['element']['#suffix'] = $element['#field_suffix'];
so we can replace '#field_suffix' by '#suffix'
Comment #5
jeffdukedotcom commentedany update on this?
Comment #6
lexa.mihu commentedSame problem.
First patch worked for me. Patch #2 fixed the title problem but didn't save the values.
Comment #7
ConradFlashback commentedfix-title.patch works for me.
Comment #8
drplfix-title.patch works for me also
Comment #9
B Boy Breaker commentedas #4 say changing to #suffix from #field_suffix is better than checking the entity like the patch #2
line 459 change #field_suffix to #suffix will fix this
Comment #10
emmanvazz commentedMy solution was similar to fix-title.patch.
Comment #11
pinueve commented+1 #9
just add some css
Comment #12
sudishth commentedfix-title.patch
it is working for me
Comment #13
sudishth commentedwell, attaching its reroll of fix-title.patch
Comment #14
sudishth commentedComment #15
cravecode commentedI prefer the patch in comment #2. Works well for me. Thanks @m.stenta!
Comment #16
philyThanks to sudishth for patch #13 that is enough for me to bring back checkbox title (Drupal 7.56, Boostrap Theme 7.x-3.14 and Entity Reference View Widget 7.x-2.0-rc7)
Comment #17
jsacksick commentedA new alter hook has been added (hook_entityreference_view_widget_rows_alter()), once implemented, you could loop over the rows and alter the #title and unset #field_suffix if necessary.
Comment #18
lelivero commentedIndeed! I've used the hook with this code to get the correct label:
Comment #19
m.stentaCan confirm that with the new version (2.1) and implementing @lelivero's hook in comment #18 above the issue is fixed for me! Thanks everyone!
Comment #20
candelas commentedSolution in #18 works, thanks @lelivero
Comment #21
arne_hortell commentedAs i have understood it, field_suffix is for rendering things after the actual field.
Therefore, for me #13 doesnt make me happy and therefore i apply this patch which only adds the
title row from fix-title.patch but doesnt remove the field_suffix row.
Works fine for me.
Comment #22
joran lafleuriel commentedThanks @Liveiro ! ...for #18 wokrs fine in template.php