Loading l10n_community/l10n_community.module +47 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,10 @@ declare(strict_types=1); /** * Strings with any status. */ use Drupal\Core\Entity\EntityInterface; use Drupal\path_alias\Entity\PathAlias; define('L10N_STATUS_ALL', 0); /** Loading Loading @@ -181,3 +185,46 @@ function l10n_community_preprocess_page_title(&$variables) { } } /** * Implements hook_ENTITY_TYPE_create(). */ function l10n_community_project_create(EntityInterface $entity) { /** @var \Drupal\l10n_server\Entity\L10nServerProjectInterface $entity */ $path_alias = PathAlias::create([ 'path' => '/translate/projects/' . $entity->id() . '/releases', 'alias' => '/translate/projects/' . $entity->getUri() . '/releases', ]); $path_alias->save(); } /** * Implements hook_ENTITY_TYPE_create(). */ function l10n_community_group_create(EntityInterface $entity) { /** @var \Drupal\group\Entity\Group $entity */ $langcode = $entity->get('field_translation_language')->first()->getValue()['target_id']; $path_alias = PathAlias::create([ 'path' => '/group/' . $entity->id() . '/translate', 'alias' => '/translate/languages/' . $langcode . '/translate', ]); $path_alias->save(); $path_alias = PathAlias::create([ 'path' => '/group/' . $entity->id() . '/board', 'alias' => '/translate/languages/' . $langcode . '/board', ]); $path_alias->save(); $path_alias = PathAlias::create([ 'path' => '/group/' . $entity->id() . '/import', 'alias' => '/translate/languages/' . $langcode . '/import', ]); $path_alias->save(); $path_alias = PathAlias::create([ 'path' => '/group/' . $entity->id() . '/export', 'alias' => '/translate/languages/' . $langcode . '/export', ]); $path_alias->save(); } Loading
l10n_community/l10n_community.module +47 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,10 @@ declare(strict_types=1); /** * Strings with any status. */ use Drupal\Core\Entity\EntityInterface; use Drupal\path_alias\Entity\PathAlias; define('L10N_STATUS_ALL', 0); /** Loading Loading @@ -181,3 +185,46 @@ function l10n_community_preprocess_page_title(&$variables) { } } /** * Implements hook_ENTITY_TYPE_create(). */ function l10n_community_project_create(EntityInterface $entity) { /** @var \Drupal\l10n_server\Entity\L10nServerProjectInterface $entity */ $path_alias = PathAlias::create([ 'path' => '/translate/projects/' . $entity->id() . '/releases', 'alias' => '/translate/projects/' . $entity->getUri() . '/releases', ]); $path_alias->save(); } /** * Implements hook_ENTITY_TYPE_create(). */ function l10n_community_group_create(EntityInterface $entity) { /** @var \Drupal\group\Entity\Group $entity */ $langcode = $entity->get('field_translation_language')->first()->getValue()['target_id']; $path_alias = PathAlias::create([ 'path' => '/group/' . $entity->id() . '/translate', 'alias' => '/translate/languages/' . $langcode . '/translate', ]); $path_alias->save(); $path_alias = PathAlias::create([ 'path' => '/group/' . $entity->id() . '/board', 'alias' => '/translate/languages/' . $langcode . '/board', ]); $path_alias->save(); $path_alias = PathAlias::create([ 'path' => '/group/' . $entity->id() . '/import', 'alias' => '/translate/languages/' . $langcode . '/import', ]); $path_alias->save(); $path_alias = PathAlias::create([ 'path' => '/group/' . $entity->id() . '/export', 'alias' => '/translate/languages/' . $langcode . '/export', ]); $path_alias->save(); }