You are here

function pathauto_i18n_update_alias in Pathauto i18n 8

Same name and namespace in other branches
  1. 7 pathauto_i18n.module \pathauto_i18n_update_alias()

Update the URL aliases for all available languages.

See also

pathauto_field_attach_form()

1 call to pathauto_i18n_update_alias()
pathauto_i18n_process_entity_object in ./pathauto_i18n.module
Insert entity to pathauto_i18n table and generate alias if necessary.

File

./pathauto_i18n.module, line 38
Provides common functions and callbacks for pathauto_i18n submodules.

Code

function pathauto_i18n_update_alias($entity, $entity_type, $bundle, $op) {

  // Generate aliases.
  module_load_include('inc', 'pathauto');
  $languages = language_list();
  $langcode = pathauto_entity_language($entity_type, $entity);
  $uri = entity_uri($entity_type, $entity);
  foreach ($languages as $language) {

    // Skipping a creating alias for node language, it created automatically.
    if (empty($entity->language) || $langcode != $language->language) {
      pathauto_create_alias($entity_type, $op, $uri['path'], array(
        $entity_type => $entity,
      ), $bundle, $language->language);
    }
  }
}