2

In the Craft CMS admin, I have an entries field on a page, and I want to limit the selectable entries available to only the child pages of the current entry.

To achieve this, I set the Selectable Entries Condition in the field's settings to only allow entries to be selected if they match the following rules: URI contains {{entry.slug}} (section type is structure and URI format is {parent.uri}/{slug}). I have multiple level one pages with the same entry type in the structure so narrowing the child pages by entry type/level/section isn't an option.

The issue I'm running into is that the field doesn't seem to recognize the twig variable, and the restriction is not applied as intended. How do you add dynamic content to the conditional field in Craft?

1 Answer 1

4

Rendering Twig in the "Selectable Entries Condition" field setting isn't actually possible, but it will be in the upcoming Craft 4.4 release, which as of writing this (march 1st 2023) is due out in a few weeks.

To install the 4.4 beta, change your craftcms/cms requirement in your composer.json file to:

^4.4.0-beta.1

...and then run composer update.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.