Problem/Motivation

When using a view that has flagable entities (products in my case), but also displays entities that have the field that creates the relationship but doesn't have the flaggable product, I am seeing this crash:

TypeError: Argument 1 passed to Drupal\flag\Plugin\views\field\FlagViewsLinkField::renderLink() must implement interface Drupal\Core\Entity\EntityInterface, null given, called in MY_SITE\web\modules\contrib\flag\src\Plugin\views\field\FlagViewsLinkField.php on line 133 in Drupal\flag\Plugin\views\field\FlagViewsLinkField->renderLink() (line 172 of MY_SITE\web\modules\contrib\flag\src\Plugin\views\field\FlagViewsLinkField.php)

Steps to reproduce

  1. add a products flag,
  2. have a content view that displays content with a product relationship,
  3. add a products flag link to the view,
  4. display one piece of contentin the view without the product.
CommentFileSizeAuthor
#4 flag_link_causes_crash-3206761-4.patch571 bytestonytheferg

Comments

tonytheferg created an issue. See original summary.

tonytheferg’s picture

Issue summary: View changes
tonytheferg’s picture

Issue summary: View changes
tonytheferg’s picture

Status: Active » Needs review
StatusFileSize
new571 bytes

This seems to fix it locally. Very unfamiliar with flags, so not sure if this is the best route.

tonytheferg’s picture

Status: Needs review » Closed (duplicate)
Related issues: +#2917836: Null passed to AJAXified FlagViewsLinkField::renderLink()