Since pathauto simply calls node_load_multiple() and then processes the nodes in the order in which they were created, the token [node:menu-link:parent:url:path] might fail since menu children may get processed before their parent.
Reordering the nodes themselves according to their menu links might be out of the scope of pathauto. I'd therefore suggest to at least add an alter hook to pathauto_node_update_alias_multiple() that allows other modules to reorder the nodes before each node gets processed by pathauto_node_update_alias(). If not, then the proper way to do this would be via hook_query_pathauto_bulk_update_alter(), since every bulk update query gets tagged with "pathauto_bulk_update".
Comment | File | Size | Author |
---|
Comments
Comment #1
ciss CreditAttribution: ciss commentedAttached patch provides a new hook
hook_pathauto_update_alias_multiple_alter(array &$entities, $entity_type)
. For the sake of consistency I've added the hook to pathauto_node_update_alias_multiple(), pathauto_taxonomy_term_update_alias_multiple() and pathauto_user_update_alias_multiple().Comment #2
ciss CreditAttribution: ciss commentedDisregard. I just realized two things:
Comment #3
ciss CreditAttribution: ciss commentedSolving this turns out to be more complicated than I anticipated. It's not enough to just implement hook_query_pathauto_bulk_update_alter() because pathauto uses the (incrementing) node id to segment the batches. Seems that hook_batch_alter() is also needed to override the batch process callback.
The orderBy should happen via (menu_link.depth, nid). This needs to reflect in $sandbox['current'].
Comment #4
thelmer CreditAttribution: thelmer at Adapt commented