Issue Feature Closed

#33138provide getPidList function in ExtBase environment (includes propsed solution)

Jonas Felix 01/12/12, 12:06 updated 03/19/20, 15:55

Description

The storagePid works great, but there are some other cases you need a list of pids and that function is not available for extbase, because it’s within tslib_piBase. We have a version that you can use within your controller.

Where should such a function be places? Is there some core lib instead of tslib_piBase?

getPidList($pid_list, $recursive = 0) {
    if (!strcmp($pid_list, '')) {
        $pid_list = $GLOBALS['TSFE']->id;
    }

    $recursive = t3lib_div::intInRange($recursive, 0);

    $pid_list_arr = array_unique(t3lib_div::trimExplode(',', $pid_list, 1));
    $pid_list     = array();

    $tree = t3lib_div::makeInstance('t3lib_queryGenerator');

    foreach($pid_list_arr as $val) {
        $val = t3lib_div::intInRange($val, 0);
            if ($val) {
            $_list = $tree->getTreeList(-1 * $val, $recursive);
            if ($_list) {
                $pid_list[] = $_list;
            }
        }
    }
    return implode(',', $pid_list);
}

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.