Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Commit

Permalink
Merge branch 'release/1.4.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent-gao committed Sep 9, 2020
2 parents 6974153 + 14b0c95 commit 19d1662
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 40 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ To start local development stack:
## License
This project is licensed under [GPL2](https://github.com/dpc-sdp/tide_site/blob/master/LICENSE.txt)

# DRUSH
## DRUSH
The Drush command `tide-site-env-domain-update`, alias `tide-si-domup`, will
update one or more taxonomy terms in the Sites vocabulary with new Domains.
This command expects an environment variable `FE_DOMAINS` to exist. The var
Expand All @@ -83,3 +83,11 @@ on pipes. The key being the tid and value being a list of domains separated by

This command can be used to ensure the preview and url enhancer features will
work on headless sites on non production environments.

## Attribution
Single Digital Presence offers government agencies an open and flexible toolkit to build websites quickly and cost-effectively.
<p align="center"><a href="https://www.vic.gov.au/what-single-digital-presence-offers" target="_blank"><img src="docs/SDP_Logo_VicGov_RGB.jpg" alt="SDP logo" height="150"></a></p>

The Department of Premier and Cabinet partnered with Salsa Digital to deliver Single Digital Presence. As long-term supporters of open government approaches, they were integral to the establishment of SDP as an open source platform.
<p align="center"><a href="https://salsadigital.com.au/" target="_blank"><img src="docs/Salsa.png" alt="Salsa logo" height="150"></a></p>

Binary file added docs/SDP_Logo_VicGov_RGB.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/SDP_Tide_product_logo_JPG.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/Salsa.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
52 changes: 13 additions & 39 deletions src/AliasStorageHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Drupal\Core\Url;
use Drupal\node\NodeInterface;
use Drupal\path_alias\PathAliasInterface;
use Drupal\pathauto\AliasUniquifierInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;

/**
Expand All @@ -34,13 +33,6 @@ class AliasStorageHelper {
*/
protected $entityTypeManager;

/**
* The Alias uniquifier service.
*
* @var \Drupal\pathauto\AliasUniquifierInterface
*/
protected $aliasUniquifier;

/**
* AliasStorageHelper constructor.
*
Expand All @@ -54,29 +46,6 @@ public function __construct(TideSiteHelper $helper, EntityTypeManagerInterface $
$this->entityTypeManager = $entity_type_manager;
}

/**
* Set the Alias Uniquifier service.
*
* @param \Drupal\pathauto\AliasUniquifierInterface $alias_uniquifier
* The service.
*/
public function setAliasUniquifier(AliasUniquifierInterface $alias_uniquifier) {
$this->aliasUniquifier = $alias_uniquifier;
}

/**
* Get the Alias Uniquifier service.
*
* @return \Drupal\pathauto\AliasUniquifierInterface
* The service.
*/
public function getAliasUniquifier() {
if (empty($this->aliasUniquifier)) {
$this->setAliasUniquifier($this->container->get('pathauto.alias_uniquifier'));
}
return $this->aliasUniquifier;
}

/**
* Check if an alias is a site alias.
*
Expand Down Expand Up @@ -186,7 +155,6 @@ public function createSiteAliases(PathAliasInterface $path, NodeInterface $node
/** @var \Drupal\Core\Entity\EntityStorageInterface $path_storage */
$path_storage = $this->entityTypeManager->getStorage('path_alias');
if ($node) {
$this->getAliasUniquifier();
/** @var string[] $aliases */
$aliases = $this->getAllSiteAliases($path, $node);

Expand Down Expand Up @@ -285,14 +253,20 @@ public function regenerateNodeSiteAliases(NodeInterface $node, array $site_ids =
// Collect all existing aliases of the node.
$aliases = [];
$path_aliases = $this->loadAll(['path' => '/node/' . $node->id()]);
foreach ($path_aliases as $path) {
// Group them by language and original alias without site prefix.
$alias = $this->getPathAliasWithoutSitePrefix(['alias' => $path->getAlias()]);
$aliases[$path->language()->getId() . ':' . $alias] = $path;
// If no path aliases exist, just generate them respectively.
if (empty($path_aliases)) {
$this->container->get('pathauto.generator')->createEntityAlias($node, 'insert');
}
// Regenerate aliases.
foreach ($aliases as $path) {
$this->createSiteAliases($path, $node, $site_ids);
else {
foreach ($path_aliases as $path) {
// Group them by language and original alias without site prefix.
$alias = $this->getPathAliasWithoutSitePrefix(['alias' => $path->getAlias()]);
$aliases[$path->language()->getId() . ':' . $alias] = $path;
}
// Regenerate aliases.
foreach ($aliases as $path) {
$this->createSiteAliases($path, $node, $site_ids);
}
}
}

Expand Down

0 comments on commit 19d1662

Please sign in to comment.