hey jason, yes it does!
I had an error for both of my contexts ("de" and "en") after updating getResources:
[2010-08-07 14:57:37] (ERROR @ /kunden/99742_65929/transkriptionen_net/core/model/modx/modtemplatevar.class.php : 422) PHP warning: DirectoryIterator::__construct(/kunden/99742_65929/transkriptionen_net/core/model/modx/processors/element/tv/renders/de/output/) [<a href=’directoryiterator.--construct’>directoryiterator.--construct</a>]: failed to open dir: No such file or directory
solution: after I added the folder "/de/output/" and "/en/output/" getResources works!
another question to the snippet: is it possible to have an universial parents parameter? (to get the resources of "all" parents)
Setting parents to 0 doesnt work for documents which are in a container...
here is my "changelanguage"-snippet, maybe you have some hints:
<?php
/**
* changelanguage
*
* snippet for change-language-links between contexts
*
* @version beta - 07.08.2010
*/
// default properties
//$current_lang = $modx->getOption('current_lang',$scriptProperties,'');
$field = 'internationalkey';
$current_internationalkey = $modx->resource->getTVValue($field);
$current_context = $modx->context->get('key');
/*
* generate array ($contextlist) with all contextkeys that are public (site_status)
*/
$contexts = $modx->getCollectionGraph('modContext', '{"ContextSettings":{}}', array(
'modContext.key:!=' => 'mgr'
,'ContextSettings.key' => 'site_status'
));
$contextlist = array();
foreach ($contexts as $context) {
$data = $context->toArray();
if (!empty($context->ContextSettings)) {
//$siteStart = reset($context->ContextSettings);
//$data = array_merge($data, array('site_start' => $siteStart->get('value')));
$siteStatus = reset($context->ContextSettings);
$data = array_merge($data, array('site_status' => $siteStatus->get('value')));
}
if($data['site_status'] != 0) {
$contextlist[] = $data['key'];
}
}
// sort contextkeys
sort($contextlist);
/*
* check if there is a resource in every context whith the same "internationalkey" (tv)
* as the current resource. if not, generate for the resource a link to site_start-
*/
$output = array();
foreach ($contextlist as $thiscontext) {
$keyoutput= $modx->runSnippet('getResources',array(
'context' => $thiscontext,
'tvFilters' => $field.'=='.$current_internationalkey,
'tpl' => 'selectlang',
'parents' => '0,2,11'
));
if ($keyoutput != '') { // if resource with same key was found, add to output
$output[] = $keyoutput;
} else { // if no resource with same key was found, generate link to the homepage of the context
$contextsb = $modx->getCollectionGraph('modContext', '{"ContextSettings":{}}', array(
'modContext.key' => $thiscontext
,'ContextSettings.key' => 'site_start'
));
foreach ($contextsb as $contextb) {
$datab = $contextb->toArray();
if (!empty($contextb->ContextSettings)) {
$siteStartb = reset($contextb->ContextSettings);
$datab = array_merge($datab, array('site_start' => $siteStartb->get('value')));
}
$idoutput = $modx->getChunk('selectlang_id', $datab);
}
$output[] = $idoutput;
}//end of if
}//end of foreach
return implode("\n", $output);
//return htmlspecialchars(implode("\n", $output));
?>