Hi,
I’ve been trying to create a multi-select template variable that lists all the children of the current document. The code below works but I want to replace the hardcoded ’7’ with the id of the page being edited.
@eval global $modx; $childArr = $modx->getDocumentChildren(7); foreach($childArr as $child){$opArr[]=$child['pagetitle']."==".$child['id'];} return $opArr;
I though that I should just be able to use $modx->documentIdentifier to get the current id but it appears that the document object is not available when generating a TV.
I’ve also tried moving the code to a snippet which, when called by the template, returns the correct array.
If I run the snippet via
@EVAL global $modx; return $modx->runSnippet('select_children'); then the array returned is the children of the root document.
Is there anyway to get the current doc ID in this situation?