Problem/Motivation
Comparator link always show
Steps to reproduce
After disable "Link for entity comparison" field in view modes of commerce product, front-end link never disappeared.
the problem is present in all mode views.
Thank you
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | issue-3256180-3.patch | 1.18 KB | mr.york |
Comments
Comment #2
lobodakyrylo commentedIt's not a bug since the module was designed to show remove link in the first row of the comparison table. If you want to customize the table, you can do it programmatically using hook_entity_comparison_rows_alter, see more in entity_comparison.api.php.
Comment #3
mr.york commentedFixed the issue.
Comment #4
nagy.balint commentedSo the issue seems to not be about the comparison table, but the view modes of the entity.
As can be seen in this guide as well https://www.webomelette.com/creating-pseudo-fields-drupal-8 when using the hook_entity_view() for extra fields the $display->getComponent has to be used to make sure that the extra field is only shown when the view mode is configured to show it (see patch in #3)
Without this patch the link to add (or remove) the entity from the comparison list is visible everywhere where the entity is rendered, no matter the view mode, but this couldnt have been intended.
Comment #5
hydra commentedYupp, this is indeed a bug - patch works perfectly fine, thank you!
Comment #6
lobodakyrylo commentedComment #7
lobodakyrylo commented