Skip to content

Instantly share code, notes, and snippets.

@Burick
Created September 26, 2016 20:44
Show Gist options
  • Save Burick/6531ea50058d72f61784deb7ee6da681 to your computer and use it in GitHub Desktop.
Save Burick/6531ea50058d72f61784deb7ee6da681 to your computer and use it in GitHub Desktop.
Определяет наличие не скрытых в дереве детей ресурса REVO
<?php
/**
* определяет наличие не скрытых в дереве детей ресурса
*
* @var {xPDO|xPDO}
*/
$parent = !empty($parent) ? $parent : $modx->resource->id;
$q = $modx->newQuery('modResource');
$q->where(array(
'show_in_tree' =>1,
'parent' => $parent,
'deleted' =>0
));
$out = '';
$out = $modx->getCount('modResource', $q)
? 'haschild'
: 'nochild';
return $out;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment