Problem/Motivation

This issue addresses the same issue as Prepare for the path alias changes in Drupal 8.8 except this patch is for the 8.x-1.x version of the module in Drupal 8.8.x.

Path aliases have been converted to entities in Drupal 8.8: https://www.drupal.org/node/3013865

Since, the path alias forms will also be converted to entity forms in #3007832: Convert custom path alias forms to entity forms, this module will need a few adjustments to in order to keep it working with the latest Drupal version.

Proposed resolution

Change references from url_alias to path_alias. Clean up hook alters.

Remaining tasks

UAT for users using this module, Drupal 8.8.x, and the pathauto module, version 8.x-1.6.

Data model changes

  1. Change references from url_alias to path_alias.
  2. Remove hook alters to path_admin_add and path_alias_delete which no longer exist in Drupal 8.8.x.
  3. Change $context from source to path in views_url_alias_node_pathauto_alias_alter().

Comments

esod created an issue. See original summary.

esod’s picture

Issue summary: View changes
esod’s picture

Issue summary: View changes
esod’s picture

StatusFileSize
new3.78 KB

patch attached.

esod’s picture

Issue summary: View changes
esod’s picture

Title: Implement path alias changes in 8.x-1.0 version » Implement path alias changes in 8.x-1.0
esod’s picture

Title: Implement path alias changes in 8.x-1.0 » Implement path alias changes in 8.x-1.x
esod’s picture

Issue summary: View changes
esod’s picture

StatusFileSize
new2.44 KB

On second thought, because of Path aliases have been converted to revisionable entities, let's leave the alter hooks in for the time being.

esod’s picture

StatusFileSize
new2.75 KB

Continue to include the the 8.8 dependency. D'oh!

esod’s picture

StatusFileSize
new3.3 KB

Left out the the url_alias to path_alias changes in #10.

esod’s picture

StatusFileSize
new4.07 KB

Continuing on with the Drupal 8.8.x changes for the 8.x-1.0 version of the module:

  1. Changing path.alias_storage to entityTypeManager.
  2. Updating the code to short array syntax.
  3. Updating drupal_set_message() to \Drupal::messenger().
taivu’s picture

patch #11 isnt working for me. the table `views_url_alias_node` was empty.

looking at the function `views_url_alias_node_rebuild()`, i was able to populate the table by changing the join() method's parameters from `source` to `path`.

should we also be changing all `source` to `path`? question arises from seeing this:

function views_url_alias_node_form_path_alias_delete_form_submit($form, FormStateInterface $form_state) {
  $build_info = $form_state->getBuildInfo();
  if (isset($build_info['args'][0])) {
    $alias_id = $build_info['args'][0];
    /** @var \Drupal\Core\Path\AliasStorage $alias_storage */
    $alias_storage = \Drupal::service('path.alias_storage');
    $alias = $alias_storage->load([
      'id' => $alias_id,
    ]);
    if (preg_match('#^/node/(\d+)$#', $alias['source'], $match)) { // <-- THIS HERE '$alias['source']
      $nid = $match[1];
      views_url_alias_node_delete($nid);
    }
  }
}
esod’s picture

StatusFileSize
new523 bytes

Changing pa.source to pa.path.

esod’s picture

StatusFileSize
new4.07 KB

Forget #14. The whole patch, this time with pa.source changed to pa.path in the query.

taivu’s picture

patch from #15 works for me! everything seems like it was before the v8.8 update. Thanks @esod!

mxwright’s picture

Status: Active » Needs review
mxwright’s picture

Patch at #15 works for me as well, on 8.8.1

mortona2k’s picture

Status: Needs review » Reviewed & tested by the community

#15 works and looks good to me.

bdanin’s picture

Any way this can be added to a release, or merged to the dev branch? I want to also apply the Drupal 9 patch (https://www.drupal.org/project/views_url_alias/issues/3142138), and this is blocking us because we need this as well. Patch from #15 has been working well for me for quite some time.

el1_1el’s picture

StatusFileSize
new5.53 KB

I encountered the same issue as #20. Here is a merged patch with 9 changes from 3142138

klimp’s picture

StatusFileSize
new4.46 KB

Updated the patch from #21 to be compatible with the Drupal 9 issue fork https://git.drupalcode.org/issue/views_url_alias-3142138/-/tree/3142138-... . The fork already includes changes required for Drupal 9 as well as some other fixes from the patch above, so the #21 patch didn't apply against that branch

el1_1el’s picture

confirming that patch in 22 works with issue branch views_url_alias-3142138. maybe someday we can go back to normal... doubt it but hoping

_shy’s picture

Version: 8.x-1.x-dev » 8.x-2.x-dev
_shy’s picture

Status: Reviewed & tested by the community » Needs work

Couldn't apply a patch to the 8.x-2.x-dev branch.

kpaxman’s picture

Version: 8.x-2.x-dev » 8.x-1.x-dev

This ticket specifically says it is for the 8.x-1.x branch, so setting back to that.

The matching issue for 8.x-2.x seems to be #3086817: Prepare for the path alias changes in Drupal 8.8.

FWIW, regardless of this, I was unable to get either patch to apply against either version.

dstorozhuk’s picture

Do we need that task taking into account that branch 8.x-1.x-dev is for Drupal before 8.8, and and this version of the Drupal is not maintained any more?
I propose to close the Issue, and ones that need that fix for their old Drupal 8 sites - can apply patch.

rachel_norfolk’s picture

Status: Needs work » Closed (outdated)

Having had no replies in a long time, I think we can close this as outdated.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.