return new JsonResponse($preview);
} #[Route(path: '/api/_action/seo-url-template/context', name: 'api.seo-url-template.context', methods: ['POST'])]
public function getSeoUrlContext(RequestDataBag
$data, Context
$context): JsonResponse
{ $routeName =
$data->
get('routeName'
);
$fk =
$data->
get('foreignKey'
);
$seoUrlRoute =
$this->seoUrlRouteRegistry->
findByRouteName($routeName);
if (!
$seoUrlRoute) { throw SeoException::
seoUrlRouteNotFound($routeName);
} $config =
$seoUrlRoute->
getConfig();
$repository =
$this->
getRepository($config);
$criteria =
new Criteria();
if (!
empty($fk)) { $criteria =
new Criteria([$fk]);
} $criteria->
setLimit(1
);