Problem/Motivation
When customizing links for JSON:API resource objects, it's very difficult (impossible in some cases) to associate cacheability of a link when the link should not be accessible for some users but accessible to others.
Proposed resolution
Add a new argument to Link::__construct()
that accepts an object implementing AccessResultInterface
and captures its cacheability if it is a cacheable dependency.
User interface changes
None.
API changes
A new optional constructor argument on Drupal\jsonapi\JsonApiResourceLink
Data model changes
None.
Release notes snippet
TBD