modxmodx-evolution

Equivalent to $modx->getDocument in YAMS


I am converting an old mono-lingual site to a multi-lingual site with YAMS. I have a snippet including articles based on ID

$doc = $modx->getDocument($fromId, '*', 1); // Search published first.

Is there equivalent using YAMS? Like this where the language is based on current article?

$doc $modx-yamsGetDocument($fromId, '*', 1);

Any tips would be greatly appreciated!


Solution

  • I'm not familiar with YAMS, but it looks like you need to run the YAMS snippet from within your code.

    You should be able to do something like this:

    $result = $modx->runSnippet('YAMS', array(
        'docid' => $fromId,
        // other parameters here
    ));
    

    Consult the YAMS snippet documentation for a list of parameters to include.