[COMPONENT][Collection] Pass current actor and their top language to query, if not otherwise specified

This commit is contained in:
Hugo Sales 2022-01-03 20:37:22 +00:00
parent a8a8cc4046
commit a729a8eddb
Signed by: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
1 changed files with 4 additions and 0 deletions

View File

@ -5,12 +5,16 @@ declare(strict_types = 1);
namespace Component\Collection\Util\Controller;
use App\Core\Controller;
use App\Entity\Actor;
use App\Util\Common;
use Component\Feed\Feed;
class Collection extends Controller
{
public function query(string $query, ?string $language = null, ?Actor $actor = null)
{
$actor ??= Common::actor();
$language ??= $actor->getTopLanguage()->getLocale();
return Feed::query($query, $this->int('page') ?? 1, $language, $actor);
}
}