Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for passing a Twig template to relation condition rules #12679

Merged
merged 3 commits into from
Feb 15, 2023

Conversation

brandonkelly
Copy link
Member

@brandonkelly brandonkelly commented Feb 15, 2023

Description

Adds support for setting relational condition rules’ element ID inputs to Twig templates, which can output an element ID dynamically.

For example, an Entries field’s Selectable Entries Condition can be set to only allow selecting entries which are related to another entry, based on the edited element’s other relations.

A Selectable Entries Condition, with a “Related To” condition rule with a dynamic element ID template

CleanShot.2023-02-14.at.16.20.05.mp4

Related issues

@brandonkelly brandonkelly requested a review from a team as a code owner February 15, 2023 00:11
@brandonkelly brandonkelly merged commit d53c5ea into 4.4 Feb 15, 2023
@brandonkelly brandonkelly deleted the feature/dynamic-relation-id branch February 15, 2023 12:49
@brandonkelly
Copy link
Member Author

Another possibility: setting an entry criteria’s “Author” setting to {{currentUser.id}} within a custom entry source’s setting:

A custom entry source’s “Entry Criteria” setting, set to pull in entries in a “News” section, with an “Article” entry type, and with an Author set to “{{currentUser.id}}”, a dynamic Twig template.

(#8423 (comment))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant