Problem/Motivation

From the parent issue

PathController::adminOverview()

We want to link to a PATH (its an path alias), and run path processing to show the alias (sadly this is not covered by unroutedUrlAssembler)

Proposed resolution

We could though fetch the alias manually.

Add an option to UnroutedUrlAssembler to perform outbound path processing. (Off by default.)

Remaining tasks

None.

User interface changes

None.

API changes

API addition: path_processing option for UnroutedUrlAssembler::assemble().

Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue priority Critical because providing a complete, solid API to generate URLs is essential for a CMS.
Prioritized changes The main goal of this issue is removing previously deprecated code.
Disruption No disruption.
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner’s picture

I think the way to go here is to add a variant to UnroutedUrlAssembler which includes path processing,
but this should be off by default. Does someone has an oppinion about that?

YesCT’s picture

Issue summary: View changes
Issue tags: -WSCCI +WSCCI. blocker

adding blocker tag, since this blocks #2343669: Remove _l() and _url(), so that the d8 blockers is accurate. Remove the blocker tag when this issue is fixed, and unpostpone 2343669 if this was the last blocker of that.

YesCT’s picture

Issue tags: -WSCCI. blocker +WSCCI, +blocker
dawehner’s picture

One simple solution would be to add opt in path processing functionality to the unrouted URL assembler.

dawehner’s picture

Status: Active » Needs review
FileSize
2.6 KB

So this is one way to fix it, this works at least, but I don't really like it, to be honest.

Status: Needs review » Needs work

The last submitted patch, 5: 2368323-5.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
FileSize
3.15 KB
566 bytes

Okay, let's feed the url assembler a litte bit more.

Status: Needs review » Needs work

The last submitted patch, 7: 2368323-7.patch, failed testing.

martin107’s picture

Status: Needs work » Needs review
FileSize
4.28 KB
1.12 KB

\Drupal\Tests\Core\Utility\UnroutedUrlAssemblerTest. now passes.

larowlan’s picture

  1. +++ b/core/lib/Drupal/Core/Utility/UnroutedUrlAssembler.php
    @@ -27,17 +28,27 @@ class UnroutedUrlAssembler implements UnroutedUrlAssemblerInterface {
    +   * @var \Drupal\Core\PathProcessor\PathProcessorManager
    ...
    +   * @param \Drupal\Core\PathProcessor\PathProcessorManager $path_processor
    +   *   The path processor manager.
    ...
    +  public function __construct(RequestStack $request_stack, ConfigFactoryInterface $config, PathProcessorManager $path_processor) {
    

    Any reason why we don't have an interface for this? I realise it implements two existing interfaces so it would be an amalgam of those.

  2. +++ b/core/lib/Drupal/Core/Utility/UnroutedUrlAssembler.php
    @@ -99,9 +110,16 @@ protected function buildLocalUrl($uri, array $options = []) {
    +
    
    @@ -126,6 +144,7 @@ protected function buildLocalUrl($uri, array $options = []) {
    +
    

    Unneeded change

andypost’s picture

+++ b/core/lib/Drupal/Core/Utility/UnroutedUrlAssembler.php
@@ -99,9 +110,16 @@ protected function buildLocalUrl($uri, array $options = []) {
+    // Allow path processing, if needed.
+    if (!empty($options['path_processing'])) {
+      $this->pathProcessor->processOutbound($uri, $options);

Any reason to make it in constructor?

larowlan’s picture

Issue summary/title says replace _l in PathController::adminOverview() but I don't see that change in the patch?

dawehner’s picture

Issue tags: +Ghent DA sprint
FileSize
7.95 KB
7.96 KB

Just be clear, I never promised that this patch would be ready ... all I wanted to do for now, is to outline what my idea is.

Any reason to make it in constructor?

... its a special usecase, so you should always manually opt in, if possible.

Status: Needs review » Needs work

The last submitted patch, 13: 2368323-13.patch, failed testing.

Wim Leers’s picture

Title: Replace _l in PathController::adminOverview() » Replace _l() in PathController::adminOverview()

Sensible solution IMO. And the patch is looking great.

  1. +++ b/core/lib/Drupal/Core/Utility/UnroutedUrlAssembler.php
    @@ -27,17 +28,27 @@ class UnroutedUrlAssembler implements UnroutedUrlAssemblerInterface {
    +   * The output path processor.
    +   *
    +   * @var \Drupal\Core\PathProcessor\OutboundPathProcessorInterface
    +   */
    +  protected $pathProcessor;
    
    @@ -99,6 +110,12 @@ protected function buildLocalUrl($uri, array $options = []) {
    +    // Allow path processing, if needed.
    +    if (!empty($options['path_processing'])) {
    +      $uri = $this->pathProcessor->processOutbound($uri, $options);
    +    }
    

    I think either of these should explicitly mention PathController::adminOverview() as an example of a valid use case.

  2. +++ b/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php
    @@ -90,6 +98,56 @@ public function providerTestAssembleWithExternalUrl() {
    +  public function testAssembleWithOutboundPathProcessorNotProcessing() {
    ...
    +  public function testAssembleWithOutboundPathProcessorWithProcessing() {
    

    I had to read these 3 times :P Could you shorten them a bit? :)

  3. +++ b/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php
    @@ -90,6 +98,56 @@ public function providerTestAssembleWithExternalUrl() {
    +   * @param string $subdir
    

    string|FALSE

dawehner’s picture

Status: Needs work » Needs review
FileSize
12.32 KB
2.57 KB

Thank you for your review!

I had to read these 3 times :P Could you shorten them a bit? :)

That is a total valid point.

This should be green now as well.

tim.plunkett’s picture

+++ b/core/includes/install.core.inc
@@ -1060,21 +1051,6 @@ function install_verify_database_settings() {
- * Verify that the database is ready (no existing Drupal installation).
- */
-function install_verify_database_ready() {
-  $system_schema = system_schema();
-  end($system_schema);
-  $table = key($system_schema);
-
-  if ($database = Database::getConnectionInfo()) {
-    if (Database::getConnection()->schema()->tableExists($table)) {
-      throw new AlreadyInstalledException(\Drupal::service('string_translation'));
-    }
-  }
-}
-

Is this from another issue?

Wim Leers’s picture

Status: Needs review » Needs work

#17: I think so. NW for that. The interdiff looks good, but the patch contains unrelated stuff. I think Daniel might've forgotten to do a hard reset :)

dawehner’s picture

Status: Needs work » Needs review
FileSize
8.04 KB

Yeah I forgot to merge the recent patch in.

Wim Leers’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community
Issue tags: +API addition

I think this is ready. A simple addition, test coverage, supporting a rare use case (hence no CR needed IMHO) that helps us to resolve the url()/l() fallout (one of the last 5 after #2364161: Replace nearly all existing _l calls).

IS updated, beta evaluation added.


Nitpicks that can be resolved on commit:

  1. +++ b/core/lib/Drupal/Core/Utility/UnroutedUrlAssembler.php
    @@ -27,17 +28,27 @@ class UnroutedUrlAssembler implements UnroutedUrlAssemblerInterface {
    +   * The output path processor.
    ...
    +   *   The output path processor.
    

    s/output/outbound/

  2. +++ b/core/lib/Drupal/Core/Utility/UnroutedUrlAssembler.php
    @@ -99,6 +110,14 @@ protected function buildLocalUrl($uri, array $options = []) {
    +    // Allow path processing, if needed.
    

    s/path processing/(outbound) path processing/

  3. +++ b/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php
    @@ -40,6 +40,13 @@ class UnroutedUrlAssemblerTest extends UnitTestCase {
    +   * The mocked path processor.
    

    outbound path processor

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

Needs a reroll...

And

+++ b/core/lib/Drupal/Core/Utility/UnroutedUrlAssembler.php
@@ -99,6 +110,14 @@ protected function buildLocalUrl($uri, array $options = []) {
+    // Allow path processing, if needed.
+    // A valid usecase is the path alias overview form:

This comment needs reflowing...

swentel’s picture

Status: Needs work » Reviewed & tested by the community
FileSize
8.07 KB
1.69 KB

Rerolled and addressed #20

dawehner’s picture

Yeaaaaah!

swentel’s picture

FileSize
8.06 KB

Rerolled - #18 is probably fine too ..

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

This issue addresses a critical bug and is allowed per https://www.drupal.org/core/beta-changes. Committed a942dd5 and pushed to 8.0.x. Thanks!

  • alexpott committed a942dd5 on 8.0.x
    Issue #2368323 by dawehner, swentel, martin107: Replace _l() in...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.