You are here

function pathauto_i18n_node_pathauto_alias_alter in Pathauto i18n 8

Same name and namespace in other branches
  1. 7 modules/pathauto_i18n_node/pathauto_i18n_node.module \pathauto_i18n_node_pathauto_alias_alter()

Implements hook_pathauto_alias_alter().

File

modules/pathauto_i18n_node/pathauto_i18n_node.module, line 68
Provides tools for creating multilanguage aliases for nodes.

Code

function pathauto_i18n_node_pathauto_alias_alter(&$alias, &$context) {
  $operations = array(
    'insert',
    'update',
    'bulkupdate',
  );

  // Skip insert of alias for all languages.
  if (!empty($context['module']) && $context['module'] == 'node' && in_array($context['op'], $operations) && !empty($context['data']['node'])) {
    $entity = $context['data']['node'];

    // Run bulk update.
    if ($context['op'] == 'bulkupdate') {
      pathauto_i18n_node_node_update($entity);
    }
    if (isset($entity->path['pathauto_i18n_status']) && $entity->path['pathauto_i18n_status'] && $context['language'] == LANGUAGE_NONE) {
      $alias = '';
    }
  }
}