Problem/Motivation
When you call "save()" function on an entity, Micro Path path is not updated.
Steps to reproduce
Enable Pathauto and Micro Path modules.
Create Basic Page node named "About".
Make a function where you load the node of "About" page to "$node".
Change the title of said node with "$node->setTitle('something new')".
Save node with "$node->save()".
Run the above code.
Check that the Micro Path path did not change.
Proposed resolution
When an entity is saved, check if it has a Pathauto pattern and if so, update the Micro Path path.
Issue fork micro_path-3361001
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 #3
markman4897 commentedComment #4
markman4897 commentedComment #5
flocondetoileHi, implementing this hook means the alias is saved / updated twice if the entity is saved from its form. The first time by the widget element, and the second time by this hook.
What prevent you to run
Drupal::service('micro_path.pathauto_generator')->updateEntitySiteAlias($entity, $site_id, 'update');just after programmatically call your
node->save()?