Problem/Motivation
Follow-up for #2575869-69: Remove all remaining usage of deprecated UrlGeneratorInterface::generateFromPath() and delete it 4.
Note this has moved to core/lib/Drupal/Core/Action/Plugin/Action/GotoAction.php
+++ b/core/modules/action/src/Plugin/Action/GotoAction.php
@@ -54,29 +55,47 @@ class GotoAction extends ConfigurableActionBase implements ContainerFactoryPlugi
+ $url = $this->configuration['url'];
+ // Leave external URLs unchanged, and assemble others as absolute URLs
+ // relative to the site's base URL.
+ if (!UrlHelper::isExternal($url)) {
+ $parts = UrlHelper::parse($url);
+ // @todo '<front>' is valid input for BC reasons, may be removed by
+ // https://www.drupal.org/node/2421941
+ if ($parts['path'] === '<front>') {
+ $parts['path'] = '';
+ }
+ $uri = 'base:' . $parts['path'];
+ $options = [
+ 'query' => $parts['query'],
+ 'fragment' => $parts['fragment'],
+ 'absolute' => TRUE,
+ ];
+ // Treat this as if it's user input of a path relative to the site's
+ // base URL.
+ $url = $this->unroutedUrlAssembler->assemble($uri, $options);
+ }
@xjm:
This is kind of hideous, but not as hideous as leaving the method around, I think. @pwolanin also suggested that we should add a followup for test coverage for actions.
Proposed resolution
Add test coverage for \Drupal\Core\Action\Plugin\Action\GotoAction, probably in the \Drupal\KernelTests\Core\Action namespace alongside other existing tests.
Remaining tasks
Determine if other actions are lacking coverage.
User interface changes
API changes
Data model changes
Issue fork drupal-2581799
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
jeroentComment #3
jeroentComment #4
jeroentComment #5
yesct commentednoting which point this was a follow up for.
Comment #19
smustgrave commentedThank you for creating this issue to improve Drupal.
We are working to decide if this task is still relevant to a currently supported version of Drupal. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or is no longer relevant. Your thoughts on this will allow a decision to be made.
Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.
Thanks!
Comment #20
smustgrave commentedAppears to still be valid.
Comment #21
mstrelan commentedUpdated IS with the new path to find the file and proposed resolution pointing to tests for other actions.
Also not sure why it's in the forms system component, moving to base system because we don't have an actions component and this action is not in a module.
Comment #23
mstrelan commentedComment #24
smustgrave commentedLooks like good coverage to me. Glad to see some good from the stale-issue work :) Thanks for picking this up!
Comment #26
dcam commentedThe MR for this issue was identified as having a new Kernel/Functional test class that did not have the
#[RunTestsInSeparateProcesses]attribute. A deprecation warning is now issued in the case of these omissions. I've rebased the MR added the attribute to prevent this from being committed as-is and accidentally breaking tests on HEAD. Because this is a minor change to test metadata and the tests are passing I am leaving the issue's status as RTBC.Comment #27
alexpottCommitted and pushed 8ff4a277ea7 to 11.x and fc5c141197d to 11.3.x. Thanks!
Backported to 11.3.x as a test only change.