diff --git a/docroot/modules/custom/va_gov_backend/va_gov_backend.module b/docroot/modules/custom/va_gov_backend/va_gov_backend.module index 504ca5dc8e..d2d9ab1493 100644 --- a/docroot/modules/custom/va_gov_backend/va_gov_backend.module +++ b/docroot/modules/custom/va_gov_backend/va_gov_backend.module @@ -1933,10 +1933,10 @@ function _va_gov_backend_disable_autopath_alias(FieldableEntityInterface $entity $toggled_on_this_save = $current_use_alias_pattern && !$original_use_alias_pattern; $active_entity = \Drupal::entityTypeManager()->getStorage('node')->load($entity->id()); $published_previously = ($active_entity instanceof NodeInterface) ? $active_entity->isPublished() : FALSE; - // Determine whether path alias is set. $path = '/node/' . (int) $active_entity->nid->value; $langcode = \Drupal::languageManager()->getCurrentLanguage()->getId(); $path_alias = \Drupal::service('path_alias.manager')->getAliasByPath($path, $langcode); + // If the path_alias is the node path, alias is not set. $path_alias_set = (bool) preg_match('/\/node\/\d+/', $path_alias) ? FALSE : TRUE; if ($path_alias_set && $published_previously && !$toggled_on_this_save) {