2

I have an entires field which is using a structure as a source. The structure has 3 levels and I would like to be able to limit it so the user can only select entries at the second level.

I've had a look through the docs and at the field settings but it doesn't seem to be doable. If anyone knows a work around or a plugin which can do this that would be great. I wonder if it is possible to create a plugin to extend this field to do this if not?

5

There's already a popular feature request for this:
"Entry Type" setting for Entries fields

But yes, it's currently also possible to do this by extending the default entries field type and adding your custom criteria with getInputSelectionCriteria().

class BusinessLogic_CustomEntriesFieldType extends EntriesFieldType
{
    public function getName()
    {
        return Craft::t('Entries (custom)');
    }

    protected function getInputSelectionCriteria()
    {
        return array(
            'level' => 2
        );
    }
}
2
  • I have up voted that feature. I'll have a look at extending that field. Many thanks!
    – Andy
    Oct 26 '15 at 9:43
  • Thanks that worked a treat! I'm going to add an additional input so you can specify the level.
    – Andy
    Oct 26 '15 at 10:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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