Hi
I added the like/dislike field to the CUSTOM comment type.
From the url "/admin/structure/comment/manage/CUSTOM/display" i have this:
IMAGE-Manage display.png
When i open my custom content type, i see this notices:
Notice: Undefined index: likes in Drupal\like_dislike\Plugin\Field\FieldFormatter\LikeDislikeFormatter->viewElements() (line 147 of modules/contrib/like_dislike/src/Plugin/Field/FieldFormatter/LikeDislikeFormatter.php).
and
Notice: Undefined index: dislikes in Drupal\like_dislike\Plugin\Field\FieldFormatter\LikeDislikeFormatter->viewElements() (line 148 of modules/contrib/like_dislike/src/Plugin/Field/FieldFormatter/LikeDislikeFormatter.php).
IMAGE-Content type.png
These notices are duplicate because there are only two comments per page.
Drupal Version: 9.3.0
"drupal/like_dislike": "^2.1"
IMAGE-Recent log messages.png

| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 3262176-4.patch | 767 bytes | anandhi karnan |
| Recent log messages.png | 112.45 KB | inman | |
| Content type.png | 56.66 KB | inman | |
| Manage display.png | 27.89 KB | inman |
Comments
Comment #2
Fanalea commentedHey,
The easiest to fix the issue is to change line 147 and 148 in src/Plugin/Field/FieldFormatter/LikeDislikeFormatter.php.
You change this part of code to:
Comment #3
inman commentedHello Fanalea!
Thank you, notices is missing.
I think it needs a patch.
Comment #4
anandhi karnan commentedAddressed #2 and here's a patch.
Comment #5
heykarthikwithuIt looks good, Thanks all :)
Comment #7
heykarthikwithu