Problem/Motivation

I'd like to be able to configure WebformEntityReferenceLinkFormatter to render a link to a form, even if the form is not permissioned to be accessible by the current user.

The use case is that we have forms and instruction pages for the forms. The pages are associated to the forms via webform fields which are rendered using WebformEntityReferenceLinkFormatter. The forms may be restricted to authenticated users or specific roles. At the moment, WebformEntityReferenceLinkFormatter will not render links if the user does not have submission_create access. But we'd still like to render the link to the forms regardless. We're routing 403s to account creation/logins anyways.

Steps to reproduce

1. Install webform.
2. Create a node type with a webform field. Render the webform field with "Link to form".
3. Create a simple webform. Restrict submission_create access to only authenticated users.
4. Create a node of the type in Step 2, reference the webform created in Step 3.
5. View the node in Step 4 while logged in.
6. View the node in Step 4 while logged out.

In Step 5, you can see the link.
In Step 6, you can't see the link.

Proposed resolution

- Configuration on WebformEntityReferenceLinkFormatter to optionally render the link even if the referenced webform is inaccessible.
- Handling that 403 after clicking the link is out of scope of the patch. There are modules for that (e.g. r4032login).

Remaining tasks

- Patch
- Review
- Merge

User interface changes

User will be able to render the webform field as a link even if the Form is inaccessible.

API changes

None

Data model changes

None

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

fskreuz created an issue. See original summary.

fskreuz’s picture

Patch for review.

jrockowitz’s picture

Status: Needs review » Closed (won't fix)

This feature request feels like an edge case that should be solved using the attached patch or custom code.