Pass context to canAddNew() and getCreateBundles()

Created on 26 March 2019, over 5 years ago
Updated 7 May 2024, 6 months ago

I would like grant access to create a new entity in an IEF field widget based on some business logic, for example, to allow a particular user to create a new content type only when editing a node form with this IEF field, which they would otherwise not have access to create.

This can be made possible by passing some contextual information to InlineEntityFormBase::canAddNew() and InlineEntityFormBase::getCreateBundles(), which then gets passed to EntityAccessControlHandler::createAccess().

Then I could use hook_entity_create_access() and hook_ENTITY_TYPE_create_access() to evaluate this context and optionally grant access.

✨ Feature request
Status

Needs review

Version

3.0

Component

Code

Created by

🇺🇸United States joelstein

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024