<?php

namespace Opentalent\OtTemplating\News;

use GeorgRinger\News\Utility\Page;
use Opentalent\OtCore\Website\OtPageRepository;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Object\ObjectManager;

class NewsFilter
{
    public function createDemandObjectFromSettings($params) {
        $pageRepo = GeneralUtility::makeInstance(ObjectManager::class)->get(OtPageRepository::class);
        $rootUid = $pageRepo->getRootPageFor($GLOBALS['TSFE']->id);
        $params['demand']->setStoragePage(Page::extendPidListByChildren(
            '' . $rootUid['uid'],
            5
        ));
    }
}
