[COMPONENT][Collection] Pass current actor and their top language to query, if not otherwise specified
This commit is contained in:
parent
a8a8cc4046
commit
a729a8eddb
|
@ -5,12 +5,16 @@ declare(strict_types = 1);
|
||||||
namespace Component\Collection\Util\Controller;
|
namespace Component\Collection\Util\Controller;
|
||||||
|
|
||||||
use App\Core\Controller;
|
use App\Core\Controller;
|
||||||
|
use App\Entity\Actor;
|
||||||
|
use App\Util\Common;
|
||||||
use Component\Feed\Feed;
|
use Component\Feed\Feed;
|
||||||
|
|
||||||
class Collection extends Controller
|
class Collection extends Controller
|
||||||
{
|
{
|
||||||
public function query(string $query, ?string $language = null, ?Actor $actor = null)
|
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);
|
return Feed::query($query, $this->int('page') ?? 1, $language, $actor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue