Skip to content
Snippets Groups Projects
Unverified Commit ce85e5a5 authored by Tobias Zimmermann's avatar Tobias Zimmermann
Browse files

Add deprecation for missing $request in EntityController::addPage()

parent 528d80f3
No related branches found
No related tags found
1 merge request!1592Add destination query parameter support to entity add page
...@@ -145,7 +145,7 @@ protected function redirect($route_name, array $route_parameters = [], array $op ...@@ -145,7 +145,7 @@ protected function redirect($route_name, array $route_parameters = [], array $op
* *
* @param string $entity_type_id * @param string $entity_type_id
* The entity type ID. * The entity type ID.
* @param \Symfony\Component\HttpFoundation\Request $request * @param ?\Symfony\Component\HttpFoundation\Request $request
* The request object. If this contains a destination query parameter, it is * The request object. If this contains a destination query parameter, it is
* "forwarded" to the add links (or the redirect response). * "forwarded" to the add links (or the redirect response).
* *
...@@ -153,7 +153,12 @@ protected function redirect($route_name, array $route_parameters = [], array $op ...@@ -153,7 +153,12 @@ protected function redirect($route_name, array $route_parameters = [], array $op
* If there's only one available bundle, a redirect response. * If there's only one available bundle, a redirect response.
* Otherwise, a render array with the add links for each bundle. * Otherwise, a render array with the add links for each bundle.
*/ */
public function addPage($entity_type_id, Request $request) { public function addPage($entity_type_id, ?Request $request = NULL) {
if ($request === NULL) {
@trigger_error('Calling ' . __METHOD__ . ' without the $request argument is deprecated in drupal:11.2.0 and it will be required in drupal:12.0.0. See https://www.drupal.org/project/drupal/issues/3490141', E_USER_DEPRECATED);
$request = \Drupal::request();
}
$entity_type = $this->entityTypeManager->getDefinition($entity_type_id); $entity_type = $this->entityTypeManager->getDefinition($entity_type_id);
$bundles = $this->entityTypeBundleInfo->getBundleInfo($entity_type_id); $bundles = $this->entityTypeBundleInfo->getBundleInfo($entity_type_id);
$bundle_key = $entity_type->getKey('bundle'); $bundle_key = $entity_type->getKey('bundle');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment