Problem/Motivation
It is not possible to configure a redirect destination (or other necessary config for certain other HTTP responses) when creating a 301/303/etc. response variant.
Proposed resolution
Edit the HttpStatusCodeDisplayVariant code to conditionally pass headers to HttpException for certain response codes and provide a UI for its configuration.
Remaining tasks
Test behavior.
User interface changes
New, likely conditional, field for header, e.g., Location, to be passed to the HttpException constructor.
API changes
None
Data model changes
Config entity will need a schema update for the new parameter.
| Comment | File | Size | Author |
|---|---|---|---|
| #35 | interdiff-30-35.txt | 7.41 KB | piggito |
| #35 | page_manager-redirect_location-2624972-35.patch | 9.19 KB | piggito |
Comments
Comment #2
tim.plunkettSounds good.
Comment #3
RKopacz commentedAny developments on this front?
Comment #4
RKopacz commentedbump? I can help with testing & documentation if needs be. Used page manager extensively to do redirects in 7, would love to see this functionality!
Comment #5
Devestaaron commentedI would also love to see this!
It seems odd that we can create a redirect but can't specify where it redirect to.
Comment #6
kalistos commentedI wanna to save us!
Comment #8
kalistos commentedSmall fix for building redirect using current params.
Comment #9
andypostComment #11
dstorozhukTested, redirect works, but there few issues:
http_status_codeusing wizard, PHP notice appears about undefinedredirect_locationvariable;http_status_codeusing wizard, and non redirect code chosen (404 etc.) - wizard doesn't go forward because of requiredredirect_location;Comment #12
dstorozhukFix:
Comment #13
dstorozhukComment #14
dstorozhukComment #15
dstorozhukUpdate page_manager.schema:
display_variant.plugin.http_status_codeto accept redirect_location parameter.Comment #18
dstorozhukComment #19
andypost@dstorozhuk please provide interdiff from #8 to make review easy https://www.drupal.org/documentation/git/interdiff
Comment #20
andypostno reason to change, see https://youtrack.jetbrains.com/issue/WI-26512
Comment #21
dstorozhukFix the schema label for
redirect_locationproperty.Add interdiff.
Comment #22
podarok@dstorozhuk I see schema changed, what about supporting upgrade path?
Comment #23
dstorozhukThere are new property added. Nothing changed, nothing removed.
@podarok what particular changes in upgrade path do you mean ?
Comment #24
podarokI mean how the schema is going to get updated after module updated for existing site?
In our case we use http://dgo.to/confi to update configs within hook_update_N @dstorozhuk
Comment #25
jlockhartWorked perfectly. Thanks. Our use case is a deprecated node whos content hasn't been fully migrated but we don't want shown. I applied the patch (clean), updated my page variant and added the path. No errors and works as expected.
As I don't believe I constitute a community I'm going to leave this as Needs Review :)
Comment #26
vprocessor commentedWorks good on my side too
Comment #27
dstorozhukComment #28
andypostNW
- tests
- upgrade path (hook_update_N to add empty property to existing variants)
Comment #29
dstorozhuk@andypost thanks for clear roadmap for that patch. I believe i can create the update path, i will be very appropriate for help with tests.
Comment #30
dstorozhukAdd update path.
Strange, but I cant chose the page_manager 8.x-4.x-dev for testing. The patch can only apply to page_manager 8.x-4.x-dev, since 8.x-1.x-dev doesn't have
function page_manager_update_8002().Comment #31
manuel.adan#30 works for me on 8.x-4.0-beta2 version
Comment #32
jlockhart#30 applied just fine on fresh pull of 8.x-4x branch. Works as expected as well.
Comment #33
andypostLast patch needs fixes for doc-blocks for new functions, also some nits below
Also still require test coverage
It needs proper DI
this does not allow remote redirects, maybe use TrustedRedirectResponse...
Better to make it protected
Comment #34
xem8vfdh commentedI am having the same problem, I think. I opened https://www.drupal.org/project/page_manager/issues/2932215#comment-12392787, but it looks like it may be a duplicate of this.
Whats the status? This seems to be core functionality for the module.
Comment #35
piggito commentedApplying the fixes suggested in #33 + some coding standard fixes
Comment #37
piggito commentedIt seems like tests are failing because of https://www.drupal.org/project/page_manager/issues/2918564
Comment #38
xem8vfdh commentedthanks @piggito. What's the next step, simply waiting for that issue you linked to be resolved?
Comment #39
piggito commented@xeM8VfDh I think we should focus on solving the linked issue first cause it is breaking Drupal CI tests for all issues in page_manager.
Comment #40
xem8vfdh commentedsounds reasonable to me @piggito. Hopefully that is resolved shortly, and this soon thereafter.
Comment #41
japerryLooked good to me and passes tests. Fixed!