- Issue created by @FrankieD3
- πΊπΈUnited States FrankieD3
I believe I have been misinformed as to how this functionality works. Apologies!
I've noticed through a custom theme hook implementation that calling the generateFromRoute
method of the \Drupal\Core\Render\MetadataBubblingUrlGenerator
class with the option ['absolute' => \Symfony\Component\Routing\Generator\UrlGeneratorInterface::ABSOLUTE_URL]
generates an absolute path, while the ABSOLUTE_PATH
constant of the same interface generates an absolute URL.
This happens everywhere that I utilize the URL generator service and has been very easy to reproduce for me.
Below is an isolated snippet than can reliably reproduce the aforementioned behavior.
/** @var \Drupal\Core\Render\MetadataBubblingUrlGenerator $url_generator */ $url_generator = \Drupal::service('url_generator'); $absolute_url = $url_generator->generateFromRoute( 'entity.node.canonical', ['node' => 1], ['absolute' => $url_generator::ABSOLUTE_URL], TRUE ); echo ($absolute_url->getGeneratedUrl()); // Output: /node/1 $absolute_path = $url_generator->generateFromRoute( 'entity.node.canonical', ['node' => 1], ['absolute' => $url_generator::ABSOLUTE_PATH], TRUE ); echo ($absolute_path->getGeneratedUrl()); // Output: http://example.com/node/1
Active
10.3 β¨
I believe I have been misinformed as to how this functionality works. Apologies!