Problem/Motivation

When an entity whose path is not managed by pathauto's patterns is give a manual URL alias, the alias is not saved.

Specifically I'm seeing this with taxonomy terms where there isn't a pattern declared for the vocabulary. On the same site I see that URL aliases are allowed to be manually set on a taxonomy term when the "Generate automatic URL alias" checkbox is deselected. This the expected Pathauto behavior.

However, on terms that aren't using Pathauto patterns, the default URL Alias field appears (as expected) without the "Generate automatic URL alias" field (again, this is expected). But when I debugged the code, it gets to this function in PathautoItem.php:

  public function postSave($update) {
    // Only allow the parent implementation to act if pathauto will not create
    // an alias.
    if ($this->pathauto == PathautoState::SKIP) {
      parent::postSave($update);
    }
    $this->get('pathauto')->persist();
  }

And it never passes the conditional. So the manual alias is sent to the pattern system which will never give a URL for the entity. This results in the URL that was entered being lost and never saved.

Proposed resolution

Update Pathauto to allow for core's path functionality to work when a pattern is not set for and entity bundle.

Comments

merauluka created an issue. See original summary.

merauluka’s picture

Issue summary: View changes
merauluka’s picture

Attached for consideration is a patch that appears to resolve this issue.

merauluka’s picture

Issue summary: View changes
Status: Active » Needs review

Changing issue status to "Needs Review" to kick off testing.