- Issue created by @chrisolof
- π·π΄Romania bbu23
Hi @chrisolof,
Thanks for reporting this issue, great catch!
I'll investigate.
If I view an entity reference field that uses a swiper formatter for its output, but I do not have view access to the referenced entities, instead of empty field output I see a broken page with two errors in the log:
Warning: Undefined array key "field_name" in Drupal\swiper_formatter\Service\Swiper->renderSwiper() (line 215 of modules/contrib/swiper_formatter/src/Service/Swiper.php)
and
InvalidArgumentException: Field is unknown. in Drupal\Core\Entity\ContentEntityBase->getTranslatedField() (line 616 of core/lib/Drupal/Core/Entity/ContentEntityBase.php).
1. Set up an entity reference field pointing at an entity type anonymous users do not have access to.
2. Set this field to display through a swiper formatter.
3. View the populated field as an admin and see the swiper.
4. View the populated field as an anonymous user and see the two errors bring down the page.
Handle lack of content due to no access to the content by returning empty instead of errors.
MR + review.
None.
None.
None.
Active
2.0
Code
Hi @chrisolof,
Thanks for reporting this issue, great catch!
I'll investigate.