diff --git a/changelogs/DP-34420.yml b/changelogs/DP-34420.yml new file mode 100644 index 0000000000..1c20db1931 --- /dev/null +++ b/changelogs/DP-34420.yml @@ -0,0 +1,41 @@ +# +# Write your changelog entry here. Every pull request must have a changelog yml file. +# +# Change types: +# ############################################################################# +# You can use one of the following types: +# - Added: For new features. +# - Changed: For changes to existing functionality. +# - Deprecated: For soon-to-be removed features. +# - Removed: For removed features. +# - Fixed: For any bug fixes. +# - Security: In case of vulnerabilities. +# +# Format +# ############################################################################# +# The format is crucial. Please follow the examples below. For reference, the requirements are: +# - All 3 parts are required and you must include "Type", "description" and "issue". +# - "Type" must be left aligned and followed by a colon. +# - "description" must be indented with 2 spaces followed by a colon +# - "issue" must be indented with 4 spaces followed by a colon. +# - "issue" is for the Jira ticket number only e.g. DP-1234 +# - No extra spaces, indents, or blank lines are allowed. +# +# Example: +# ############################################################################# +# Fixed: +# - description: Fixes scrolling on edit pages in Safari. +# issue: DP-13314 +# +# You may add more than 1 description & issue for each type using the following format: +# Changed: +# - description: Automating the release branch. +# issue: DP-10166 +# - description: Second change item that needs a description. +# issue: DP-19875 +# - description: Third change item that needs a description along with an issue. +# issue: DP-19843 +# +Fixed: + - description: Fix error items in entity usage queue. + issue: DP-34420 diff --git a/composer.json b/composer.json index 83b50a907b..6c4dd9b455 100644 --- a/composer.json +++ b/composer.json @@ -372,6 +372,9 @@ "Trying to edit embedded entities causes uncaught exception (https://www.drupal.org/project/entity_embed/issues/3416512)": "https://git.drupalcode.org/project/entity_embed/-/merge_requests/39.diff", "Alt text optional": "patches/DP-33643_entity_embed_alt_optional.patch" }, + "drupal/entity_usage": { + "InvalidArgumentException: The internal path component is invalid. (https://www.drupal.org/project/entity_usage/issues/3378832)": "https://git.drupalcode.org/project/entity_usage/-/merge_requests/55.diff" + }, "drupal/flag": { "Flags problem with VBO module in views (2893259)": "https://www.drupal.org/files/issues/2020-07-25/flag-vbo-2893259-40.patch" }, diff --git a/composer.lock b/composer.lock index e82980e11a..4c35d97aca 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "8327809d92a9da19dea2c3c0cedd123d", + "content-hash": "f88ab76878597548cf0ca7c2f165a62e", "packages": [ { "name": "akamai-open/edgegrid-auth", @@ -5243,6 +5243,10 @@ "GPL-2.0+" ], "authors": [ + { + "name": "Lullabot", + "homepage": "https://www.drupal.org/user/3815489" + }, { "name": "marcoscano", "homepage": "https://www.drupal.org/user/1288796" diff --git a/docroot/modules/custom/mass_content/src/Field/DynamicListByLabel.php b/docroot/modules/custom/mass_content/src/Field/DynamicListByLabel.php index c233a4f912..853e96554f 100644 --- a/docroot/modules/custom/mass_content/src/Field/DynamicListByLabel.php +++ b/docroot/modules/custom/mass_content/src/Field/DynamicListByLabel.php @@ -20,6 +20,10 @@ protected function queries() { $term_ids[] = $term->id(); } + if (empty($term_ids)) { + return []; + } + $types = [ 'advisory', 'binder', diff --git a/docroot/modules/custom/mass_content/src/Field/QueryGeneratedDynamicEntityReferenceList.php b/docroot/modules/custom/mass_content/src/Field/QueryGeneratedDynamicEntityReferenceList.php index e5c583ac39..1ed48be720 100644 --- a/docroot/modules/custom/mass_content/src/Field/QueryGeneratedDynamicEntityReferenceList.php +++ b/docroot/modules/custom/mass_content/src/Field/QueryGeneratedDynamicEntityReferenceList.php @@ -33,9 +33,13 @@ public function computeValue() { $queries = $this->queries(); $i = 0; foreach ($queries as $type => $query) { - foreach ($query->accessCheck(FALSE)->execute() as $id) { - $this->list[$i] = $this->createItem($i, ['target_id' => $id, 'target_type' => $type]); - $i++; + $result = $query->accessCheck(FALSE)->execute(); + // Check if the query result is not empty before processing it. + if (!empty($result)) { + foreach ($result as $id) { + $this->list[$i] = $this->createItem($i, ['target_id' => $id, 'target_type' => $type]); + $i++; + } } } } diff --git a/docroot/modules/custom/mass_validation/mass_validation.module b/docroot/modules/custom/mass_validation/mass_validation.module index 97f4cab4c1..e20ff0826d 100644 --- a/docroot/modules/custom/mass_validation/mass_validation.module +++ b/docroot/modules/custom/mass_validation/mass_validation.module @@ -1541,6 +1541,42 @@ function mass_validation_get_title_from_uri($uri) { } } } + // Add condition to the helper function to try finding the titles + // from other uri schemas as well even if it is a redirected one. + elseif (stripos($uri, 'internal:/') === 0) { + // Extract the path from the internal URI. + $internal_path = str_replace('internal:/', '', $uri); + + // Convert the internal path to its system path. + $path_alias_manager = \Drupal::service('path_alias.manager'); + $system_path = $path_alias_manager->getPathByAlias('/' . $internal_path); + + // Check if the path corresponds to a node. + if (preg_match('/node\/(\d+)/', $system_path, $matches)) { + $nid = $matches[1]; + $node = Node::load($nid); + if ($node) { + return $node->getTitle(); + } + } + else { + $redirects = Drupal::entityTypeManager()->getStorage('redirect')->loadByProperties(['redirect_source__path' => $internal_path]); + if ($redirect = reset($redirects)) { + if ($target = $redirect->getRedirectUrl()->toString()) { + $system_path = $path_alias_manager->getPathByAlias($target); + // Check if the path corresponds to a node. + if (preg_match('/node\/(\d+)/', $system_path, $matches)) { + $nid = $matches[1]; + $node = Node::load($nid); + if ($node) { + return $node->getTitle(); + } + } + } + } + } + } + return NULL; }