You are here

function tome_sync_pathauto_alias_alter in Tome 8

Implements hook_pathauto_alias_alter().

Disables path auto during the import process, to avoid aliases being created on entity save before exported path_alias entities are imported.

This relies on a specific return statement in the pathauto codebase, see \Drupal\pathauto\PathautoGenerator::createEntityAlias after the alter call for details.

File

modules/tome_sync/tome_sync.module, line 91
Keeps content, config, and files in sync.

Code

function tome_sync_pathauto_alias_alter(&$alias, array &$context) {
  if (\Drupal::service('tome_sync.importer')
    ->isImporting()) {
    $alias = '';
  }
}