How to output child resources as a dropdown list in the parent category?

Hi there,

Is it possible to output child resources as a dropdown list while editing parent category in backend? Also is it possible to edit those child resources’ TV in parent category?

Like this:

It will take a bit of code and the list-view instead of a textarea. Can’t help you much further, but I bet someone will.

Maybe you can create a new template variable with the Input Type = “Listbox (Multi-Select)” and a chunk binding in the field Input Option Values.

@CHUNK listChildren

Then create a chunk listChildren that calls a snippet

[[listChildren]]

and create a snippet listChildren with code like this to load the child-resources.

<?php
$current_id = $modx->resource->get('id');

$q = $modx->newQuery('modResource', array('parent' => $current_id));
$q->sortby('menuindex','ASC');
$resources = $modx->getCollection('modResource', $q);
$output = array();
foreach ($resources as $resource) {
   $output[] = $resource->get('pagetitle') . '==' . $resource->get('id');
}
return implode('||',$output);

Thank you for the anwer, but I need to output it in the backend

what @halftrainedharry has posted is for the manager (what you are calling the backend)

I’m not sure, if $modx->resource is available here, though, but you get the id from request, if not.