I have two problems. One is that I need to get the id of the parent of a document whose ID I have. In this context it works:
[[!getResourceField?&id=`[[+contentID]]`&field=`parent`]]
The ID is returned correctly. But when I nest this snippet in another, nothing is returned:
[[!GetResources?
&parents=`[[!getResourceField?&id=`[[+contentID]]`&field=`parent`]]`
&tpl=`mfTaxonItemsTpl`
&limit=`0`
&depth=`0`
&sortby=`{"pagetitle":"ASC"}`
&showHidden=`1`
]]
I can verify that the get Roesources snippet returns an expected result if I don't use the placeholder value for the parents parameter. That's problem number one.
As a workaround, because the content ID placeholder is set in a snippet I wrote, I thought I could simply set the parent as a placeholder in the same snippet. It's actually cleaner, in principle, but I can't get that to work either:
$contentID = $modx -> parseChunk('mfMostRecentItemID');
$modx -> setPlaceholder('contentID', $contentID);
$taxonIDArr = $modx -> getParentIds($contentID);
$modx -> setPlaceholder('taxonID', $taxonIDArr[0]);
I can verify that the taxonIDArr is empty, and therefore the placeholder taxonID is not set, unless I use a value for the getParentIds method that is either a number or a variable set to a number. The variable I set by parsing a chunk does not give a result.
Both avenues for solving this problem have run aground. I'd love help understanding either or both of them.
Revo 2.0.8