Problem/Motivation
I have a node content type with a pattern like this:
[node:field_ref_term:entity:field_text_url_path]/[node:field_text_url_path]
When I save a node manually, the URL alias is updated correctly.
When I import nodes with Feeds, the URL alias is updated correctly.
When I delete all aliases and use bulk regenerate to make more, the URL alias is updated correctly.
However, when I save a node programmatically like this:
$node = Node::load($nid);
$node->setChangedTime(\Drupal::time()->getRequestTime());
$node->save();Then the pathauto alias is "[node:field_ref_term:entity:field_text_url_path]-number", as there are several nodes with the same term reference, and the number is used to distinguish them.
Steps to reproduce
1. Create a content type with a taxonomy term reference.
2. Add a text field to the content type, "field_text_url_path".
3. Add a text field to the taxonomy vocabulary, "field_text_url_path".
4. Try saving a node of the content type with $node->save() as described above.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | function_pathauto_update_8100-3265344-3.patch | 23.81 KB | rohit.rawat619 |
| #3 | function_pathauto_update_8100-3265344-3.patch | 23.81 KB | rohit.rawat619 |
Issue fork pathauto-3265344
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
rohit.rawat619 commentedi Fix code by some function like pathauto_update_8100(){}
Comment #3
rohit.rawat619 commentedi Fix code by some function like pathauto_update_8100(){}
Comment #4
rohit.rawat619 commentedi Fix some code by pathauto_update_8100(){}
Kindly,Review this
Comment #5
rohit.rawat619 commentedComment #6
ravimalviya2000 commentedHi,
On below issues some discussion done for node saving by programming.
issues : https://www.drupal.org/project/pathauto/issues/1462080
There triggered alias parameter when node save.
Comment #7
mably commentedPatch is unreadable, too many unrelated changes.
Please provide MR.
Comment #9
mably commentedPushed a kernel test that tries to reproduce the above scenario without success.
So closing as "Cannot reproduce".