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

[SDPTA-1019] GetAllSiteSections #151

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 39 additions & 37 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,42 +1,44 @@
{
"name": "dpc-sdp/tide_site",
"description": "Post content to multiple sites and sections.",
"type": "drupal-module",
"license": "GPL-2.0-or-later",
"require": {
"dpc-sdp/tide_core": "^4.0.0",
"dpc-sdp/tide_media": "^4.0.0",
"drupal/create_menus_permission": "dev-drupal_10_compatibility",
"drupal/key_value_field": "^1.3"
"description": "Post content to multiple sites and sections.",
"extra": {
"drush": {
"services": {
"drush.services.yml": "^10"
}
},
"suggest": {
"dpc-sdp/tide_api:^4.0.0": "Allows to use Drupal in headless mode"
},
"repositories": {
"drupal": {
"type": "composer",
"url": "https://packages.drupal.org/10",
"exclude": ["drupal/create_menus_permission"]
},
"drupal/create_menus_permission": {
"type": "vcs",
"no-api": true,
"url": "https://github.com/dpc-sdp/create_menus_permission.git"
}
"patches": {
"drupal/core": {
"Add a token for publication status - https://www.drupal.org/project/drupal/issues/3073554": "https://www.drupal.org/files/issues/2019-08-09/3073554_10.patch"
},
"drupal/linkit": {
"Unpublished nodes not included even when option is selected - https://www.drupal.org/project/linkit/issues/3049946#comment-14953079": "https://www.drupal.org/files/issues/2023-03-06/linkit-unpublished-nodes-not-included-3049946-32.patch"
}
}
},
"license": "GPL-2.0-or-later",
"name": "dpc-sdp/tide_site",
"repositories": {
"drupal": {
"exclude": [
"drupal/create_menus_permission"
],
"type": "composer",
"url": "https://packages.drupal.org/10"
},
"extra": {
"drush": {
"services": {
"drush.services.yml": "^10"
}
},
"patches": {
"drupal/core": {
"Add a token for publication status - https://www.drupal.org/project/drupal/issues/3073554": "https://www.drupal.org/files/issues/2019-08-09/3073554_10.patch"
},
"drupal/linkit": {
"Unpublished nodes not included even when option is selected - https://www.drupal.org/project/linkit/issues/3049946#comment-14953079": "https://www.drupal.org/files/issues/2023-03-06/linkit-unpublished-nodes-not-included-3049946-32.patch"
}
}
"drupal/create_menus_permission": {
"no-api": true,
"type": "vcs",
"url": "https://github.com/dpc-sdp/create_menus_permission.git"
}
},
"require": {
"dpc-sdp/tide_core": "dev-reference",
"dpc-sdp/tide_media": "dev-reference",
"drupal/create_menus_permission": "dev-drupal_10_compatibility",
"drupal/key_value_field": "^1.3"
},
"suggest": {
"dpc-sdp/tide_api:^4.0.0": "Allows to use Drupal in headless mode"
},
"type": "drupal-module"
}
25 changes: 25 additions & 0 deletions src/TideSiteHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,31 @@ public function getAllSites() {
return $sites;
}


/**
* Returns all sites.
*
* @return \Drupal\taxonomy\TermInterface[]
* List of sites.
*/
public function getAllSitesAndSiteSections() {
$sites = [];

try {
$terms = $this->entityTypeManager->getStorage('taxonomy_term')
->loadByProperties(['vid' => 'sites']);
/** @var \Drupal\taxonomy\TermInterface $site */
foreach ($terms as $site) {
$sites[$site->id()] = $site;
}
}
catch (\Exception $exception) {
watchdog_exception('tide_site', $exception);
}

return $sites;
}

/**
* Loads a Site term by ID.
*
Expand Down
Loading