/** * Populate content for the request * * @param Route $route * @param Request $request */ protected function populateContent(Route $route, Request $request) { $content = $route->getContent(); $name = $content; if ($route->isList()) { $name .= 's'; $value = $this->repository->getContents($content, $route->getIndexBy(), $route->getOrder()); if ($route->isPaginated()) { $paginator = new Paginator($value, $route->getPerPage()); $value = $paginator->get($request->attributes->get('page')); $request->attributes->set('paginator', $paginator); } } else { $value = $this->repository->getContent($content, $request->attributes->get($content)); } $request->attributes->set($name, $value); }
/** * {@inheritdoc} */ public function handle($value, array $context) { return ContentRepository::getName($context['file']); }