Page::getChildPids()
\nn\t3::Page()->getChildPids($parentPid = 0, $recursive = 999);
Get list of child ids of one or more pages.
\nn\t3::Page()->getChildPids( 123, 1 );
\nn\t3::Page()->getChildPids( [123, 124], 99 );
Copied!
| @return array
Source Code
public function getChildPids( $parentPid = 0, $recursive = 999 )
{
if (!$parentPid) return [];
if (!is_array($parentPid)) $parentPid = [$parentPid];
$mergedPids = [];
$treeRepository = GeneralUtility::makeInstance( PageRepository::class );
foreach ($parentPid as $pid) {
$childPids = \nn\t3::Arrays( $treeRepository->getPageIdsRecursive( [$pid], $recursive ) )->intExplode();
$mergedPids = array_merge( $childPids, $mergedPids );
}
return $mergedPids;
}
Copied!