diff --git a/pathauto.api.php b/pathauto.api.php index 7d42a83..aa08b12 100644 --- a/pathauto.api.php +++ b/pathauto.api.php @@ -209,3 +209,17 @@ function hook_pathauto_punctuation_chars_alter(array &$punctuation) { // Remove the dollar sign. unset($punctuation['dollar']); } + +/** + * Alter the list of entities before they get bulk-updated. + * + * @param $entities + * An array of entities that are about to get updated. + * @param $entity_type + * The entity type for the current set of entities. + */ +function hook_pathauto_update_alias_multiple_alter(array &$entities, $entity_type) { + if ($entity_type === 'node') { + usort($entities, '_example_order_nodes_by_menu_depth'); + } +} diff --git a/pathauto.module b/pathauto.module index 9bb132d..be73e75 100644 --- a/pathauto.module +++ b/pathauto.module @@ -601,6 +601,7 @@ function pathauto_node_update_alias_multiple(array $nids, $op, array $options = $options += array('message' => FALSE); $nodes = node_load_multiple($nids); + drupal_alter('pathauto_update_alias_multiple', $nodes, $entity_type = 'node'); foreach ($nodes as $node) { pathauto_node_update_alias($node, $op, $options); } @@ -731,6 +732,7 @@ function pathauto_taxonomy_term_update_alias_multiple(array $tids, $op, array $o $options += array('message' => FALSE); $terms = taxonomy_term_load_multiple($tids); + drupal_alter('pathauto_update_alias_multiple', $terms, $entity_type = 'taxonomy_term'); foreach ($terms as $term) { pathauto_taxonomy_term_update_alias($term, $op, $options); } @@ -846,6 +848,7 @@ function pathauto_user_update_alias_multiple(array $uids, $op, array $options = $options += array('message' => FALSE); $accounts = user_load_multiple($uids); + drupal_alter('pathauto_update_alias_multiple', $accounts, $entity_type = 'user'); foreach ($accounts as $account) { pathauto_user_update_alias($account, $op, $options); }