Skip to content

Commit

Permalink
Deprecate the AdminContext:getReferrer() method
Browse files Browse the repository at this point in the history
  • Loading branch information
javiereguiluz committed Jan 4, 2025
1 parent faa7730 commit 384741e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
18 changes: 18 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,24 @@ that page title:
}
}

EasyAdmin 4.8.11
----------------

EasyAdmin URLs no longer include the `referrer` query parameter, and the
`AdminContext:getReferrer()` method is deprecated.

This change is part of the long-term project to simplify URLs, with the goal of
using pretty URLs in the future. If you still need to access the referrer, you
can retrieve it from the HTTP headers provided by browsers:

```php
// Before
return $this->redirect($context->getReferrer());
// After
return $this->redirect($context->getRequest()->headers->get('referer'));
```

EasyAdmin 4.8.0
---------------

Expand Down
7 changes: 7 additions & 0 deletions src/Context/AdminContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ public function getRequest(): Request

public function getReferrer(): ?string
{
trigger_deprecation(
'easycorp/easyadmin-bundle',
'4.8.11',
'EasyAdmin URLs no longer include the referrer URL. If you still need it, you can get the referrer provided by browsers via $context->getRequest()->headers->get(\'referer\').',
__METHOD__,
);

$referrer = $this->request->query->get(EA::REFERRER);

return '' !== $referrer ? $referrer : null;
Expand Down

0 comments on commit 384741e

Please sign in to comment.