1
0
mirror of https://github.com/flarum/core.git synced 2025-10-11 23:14:29 +02:00

Make the Request available to the Formatter\Rendering event (#1721)

This is important because extensions may wish to render post content
differently depending on Request factors such as the actor. For example,
an attachments extension might wish to hide attachments from guests.

This solution is a bit of a hack-job for now, but soon when we refactor
the API layer to use tobscure/json-api-server, and also refactor the
Formatter layer, it can be revised.
This commit is contained in:
Toby Zerner
2019-01-23 09:03:49 +10:30
committed by Franz Liedke
parent 9b68bbe44e
commit 0ab9facc4b
7 changed files with 43 additions and 19 deletions

View File

@@ -102,7 +102,7 @@ abstract class AbstractSerializeController implements RequestHandlerInterface
);
$serializer = static::$container->make($this->serializer);
$serializer->setActor($request->getAttribute('actor'));
$serializer->setRequest($request);
$element = $this->createElement($data, $serializer)
->with($this->extractInclude($request))