Use @SNIPPET Binding in Dropdown

I want to add a dropdown with all resources below a specific parend Sounds like perfect for a getResource binding. But I’m not how. This is the code I added into the options input field:

@SNIPPET getResources {"parents":"15","tpl":"@CODE: [[+pagetitle]]==[[+id]]"}

But it doesn’t work. How to do this?

The @SNIPPET binding in ContentBlocks dropdown values don’t support properties like that currently.

You would need to do something like @SNIPPET getResourcesIn15 and create a snippet named getResourcesIn15 that runs return $modx->runSnippet('getResources', ['parents' => 15, 'tpl' => '@CODE: [[+pagetitle]]==[[+id]]']);

It’d be great to have support for the json params; any plans for that being added?

Also useful would be having an @CHUNK binding, which could more easily implemented (maybe ?). I sometimes use a chunk just to make list-specific calls that pass params to a general-purpose list getter snippet I created.

This works with just some small changes:

return $modx->runSnippet('getResources', [
    'parents' => 13,
    'limit' => 0,
    'sortby' => 'pagetitle',
    'tpl' => '@INLINE [[+id]]==[[+pagetitle]]'
]);