From f8c02e4a9ba735f195fdab4ee732d8d20b53b36d Mon Sep 17 00:00:00 2001 From: Edmund Dunn Date: Thu, 21 Dec 2023 08:19:34 -0800 Subject: [PATCH 1/8] VACMS-16457: update fro entity_browser with patches --- composer.json | 6 +- composer.lock | 38 ++++---- ...o-member-function-getstorage-on-null.patch | 36 ++++++++ ...o-member-function-getstorage-on-null.patch | 87 +++++++++++++++++++ 4 files changed, 148 insertions(+), 19 deletions(-) create mode 100644 patches/3408216-error-call-to-member-function-getstorage-on-null.patch create mode 100644 patches/3408217-error-call-to-member-function-getstorage-on-null.patch diff --git a/composer.json b/composer.json index 0d202a004d..352794ff1e 100644 --- a/composer.json +++ b/composer.json @@ -406,10 +406,12 @@ }, "drupal/entity_browser": { "2856138 - Entity browser cardinality validation": "https://www.drupal.org/files/issues/0001-Issue-2856138-by-gordon-Error-messages-are-not-being.patch", - "3191302 - Make modal iframe tab accessible": "https://www.drupal.org/files/issues/2021-01-07/3191302-3.patch" + "3191302 - Make modal iframe tab accessible": "https://www.drupal.org/files/issues/2021-01-07/3191302-3.patch", + "3408216 - Error: Call to a member function getStorage() on null": "https://www.drupal.org/files/issues/2023-12-21/3408216-error-call-to-member-function-getstorage-on-null.patch" }, "drupal/entity_browser_table": { - "3194622 - Custom field validation should not be applied to remove button": "https://www.drupal.org/files/issues/2021-01-25/limit-remove-button-validators.patch" + "3194622 - Custom field validation should not be applied to remove button": "https://www.drupal.org/files/issues/2021-01-25/limit-remove-button-validators.patch", + "3408217 - Error: Call to a member function getStorage() on null": "https://www.drupal.org/files/issues/2023-12-21/3408217-error-call-to-member-function-getstorage-on-null.patch" }, "drupal/entity_clone": { "3112577 - Cloning child references to nodes has potential to cause memory resource issues": "https://www.drupal.org/files/issues/2020-02-10/entity_clone-child-node-system-drain-3112577-1.patch" diff --git a/composer.lock b/composer.lock index 67b221ec11..51dc964a11 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": "cb8fda1d112e05be8fece3fbc7c46e03", + "content-hash": "4726d4915fbaeb386a31a876ffd0c6ae", "packages": [ { "name": "asm89/stack-cors", @@ -5146,35 +5146,39 @@ }, { "name": "drupal/entity_browser", - "version": "2.9.0", + "version": "2.10.0", "source": { "type": "git", "url": "https://git.drupalcode.org/project/entity_browser.git", - "reference": "8.x-2.9" + "reference": "8.x-2.10" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/entity_browser-8.x-2.9.zip", - "reference": "8.x-2.9", - "shasum": "251afad80cde9fa547501a8d9de5d94b9f5bacff" + "url": "https://ftp.drupal.org/files/projects/entity_browser-8.x-2.10.zip", + "reference": "8.x-2.10", + "shasum": "d52548ea66dc56108c2e211aeaff6e1cc0522e85" }, "require": { - "drupal/core": "^9.2 || ^10" + "drupal/core": "^9.5 || ^10" + }, + "conflict": { + "drupal/media_entity": "1.*" }, "require-dev": { - "drupal/embed": "~1.0", - "drupal/entity_embed": "1.x-dev", - "drupal/entity_reference_revisions": "1.x-dev", - "drupal/entityqueue": "1.x-dev", - "drupal/inline_entity_form": "1.x-dev", - "drupal/paragraphs": "1.x-dev", - "drupal/token": "1.x-dev" + "drupal/ckeditor": "^1.0", + "drupal/embed": "^1.0", + "drupal/entity_embed": "^1.0", + "drupal/entity_reference_revisions": "^1.0", + "drupal/entityqueue": "^1.0", + "drupal/inline_entity_form": "^1.0@rc", + "drupal/paragraphs": "^1.0", + "drupal/token": "^1.0" }, "type": "drupal-module", "extra": { "drupal": { - "version": "8.x-2.9", - "datestamp": "1674070933", + "version": "8.x-2.10", + "datestamp": "1702325310", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -5227,7 +5231,7 @@ } ], "description": "Entity browsing and selecting component.", - "homepage": "http://drupal.org/project/entity_browser", + "homepage": "https://drupal.org/project/entity_browser", "support": { "source": "https://git.drupalcode.org/project/entity_browser", "issues": "https://www.drupal.org/project/issues/entity_browser", diff --git a/patches/3408216-error-call-to-member-function-getstorage-on-null.patch b/patches/3408216-error-call-to-member-function-getstorage-on-null.patch new file mode 100644 index 0000000000..05cd72c4d7 --- /dev/null +++ b/patches/3408216-error-call-to-member-function-getstorage-on-null.patch @@ -0,0 +1,36 @@ +diff --git a/src/Plugin/Field/FieldWidget/EntityReferenceBrowserWidget.php b/src/Plugin/Field/FieldWidget/EntityReferenceBrowserWidget.php +index 13df19e50ae44393a651c46a0524065d0c29c921..f9df033be5e7a0d616105ff8f2f69f756a366af7 100644 +--- a/src/Plugin/Field/FieldWidget/EntityReferenceBrowserWidget.php ++++ b/src/Plugin/Field/FieldWidget/EntityReferenceBrowserWidget.php +@@ -835,7 +835,31 @@ class EntityReferenceBrowserWidget extends WidgetBase { + } + } + return $entities; ++ }foreach ($stored_ids as $entity_id) { ++ if (isset($indexed_entities[$entity_id])) { ++ $entities[] = $indexed_entities[$entity_id]; ++ } ++ } ++ if (!empty($entities)) { ++ return $entities; ++ } ++ // We are loading for for the first time so we need to load any existing ++ // values that might already exist on the entity. Also, remove any leftover ++ // data from removed entity references. ++ else { ++ foreach ($items as $item) { ++ if (isset($item->target_id)) { ++ if (!is_null($entity_storage)) { ++ $entity = $entity_storage->load($item->target_id); ++ if (!empty($entity)) { ++ $entities[] = $entity; ++ } ++ } ++ } ++ } ++ return $entities; + } ++ + } + + /** diff --git a/patches/3408217-error-call-to-member-function-getstorage-on-null.patch b/patches/3408217-error-call-to-member-function-getstorage-on-null.patch new file mode 100644 index 0000000000..831a1f2dec --- /dev/null +++ b/patches/3408217-error-call-to-member-function-getstorage-on-null.patch @@ -0,0 +1,87 @@ +diff --git a/src/Plugin/Field/FieldWidget/EntityReferenceBrowserTableWidget.php b/src/Plugin/Field/FieldWidget/EntityReferenceBrowserTableWidget.php +index 177fda745f27e21d6377025e50b2caee9f28894a..af1f8b00834c9d9fadf9314a26c67769732d1694 100644 +--- a/src/Plugin/Field/FieldWidget/EntityReferenceBrowserTableWidget.php ++++ b/src/Plugin/Field/FieldWidget/EntityReferenceBrowserTableWidget.php +@@ -4,19 +4,10 @@ namespace Drupal\entity_browser_table\Plugin\Field\FieldWidget; + + use Drupal\Component\Plugin\Exception\PluginException; + use Drupal\Component\Utility\Html; +-use Drupal\content_moderation\ModerationInformation; + use Drupal\Core\Entity\EntityInterface; +-use Drupal\Core\Entity\EntityTypeBundleInfo; +-use Drupal\Core\Entity\EntityTypeManagerInterface; +-use Drupal\Core\Extension\ModuleHandlerInterface; +-use Drupal\Core\Field\FieldDefinitionInterface; + use Drupal\Core\Field\FieldItemListInterface; + use Drupal\Core\Form\FormStateInterface; +-use Drupal\Core\Language\LanguageManagerInterface; +-use Drupal\Core\Messenger\MessengerInterface; +-use Drupal\Core\Session\AccountInterface; + use Drupal\Core\Url; +-use Drupal\entity_browser\FieldWidgetDisplayManager; + use Drupal\entity_browser\Plugin\Field\FieldWidget\EntityReferenceBrowserWidget; + use Symfony\Component\DependencyInjection\ContainerInterface; + +@@ -47,55 +38,13 @@ class EntityReferenceBrowserTableWidget extends EntityReferenceBrowserWidget { + protected $moderationInfo; + + public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { +- +- return new static( +- $plugin_id, +- $plugin_definition, +- $configuration['field_definition'], +- $configuration['settings'], +- $configuration['third_party_settings'], +- $container->get('entity_type.manager'), +- $container->get('plugin.manager.entity_browser.field_widget_display'), +- $container->get('module_handler'), +- $container->get('current_user'), +- $container->get('messenger'), +- $container->get('language_manager'), +- $container->get('entity_type.bundle.info'), +- $container->has('content_moderation.moderation_information') +- ? $container->get('content_moderation.moderation_information') +- : NULL +- ); +- } +- +- public function __construct( +- $plugin_id, +- array $plugin_definition, +- FieldDefinitionInterface $field_definition, +- array $settings, +- array $third_party_settings, +- EntityTypeManagerInterface $entity_type_manager, +- FieldWidgetDisplayManager $field_display_manager, +- ModuleHandlerInterface $module_handler, +- AccountInterface $current_user, +- MessengerInterface $messenger, +- LanguageManagerInterface $languageManager, +- EntityTypeBundleInfo $bundleInfo, +- ModerationInformation $moderationInformation = NULL) { +- parent::__construct( +- $plugin_id, +- $plugin_definition, +- $field_definition, +- $settings, +- $third_party_settings, +- $entity_type_manager, +- $field_display_manager, +- $module_handler, +- $current_user, +- $messenger +- ); +- $this->currentLanguage = $languageManager->getCurrentLanguage()->getId(); +- $this->entityBundleInfo = $bundleInfo; +- $this->moderationInfo = $moderationInformation; ++ $instance = parent::create($container, $configuration, $plugin_id, $plugin_definition); ++ $instance->currentLanguage = $container->get('language_manager')->getCurrentLanguage()->getId(); ++ $instance->entityBundleInfo = $container->get('entity_type.bundle.info'); ++ $instance->moderationInfo = $container->has('content_moderation.moderation_information') ++ ? $container->get('content_moderation.moderation_information') ++ : NULL; ++ return $instance; + } + + /** From ad90d52db6c04e854c0072e00bc969127fa5a4f1 Mon Sep 17 00:00:00 2001 From: Edmund Dunn Date: Thu, 21 Dec 2023 12:13:36 -0800 Subject: [PATCH 2/8] VACMS-16457: removed unneeded cypress test --- .../entity_reference_validation.feature | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 tests/cypress/integration/features/platform/entity_reference_validation.feature diff --git a/tests/cypress/integration/features/platform/entity_reference_validation.feature b/tests/cypress/integration/features/platform/entity_reference_validation.feature deleted file mode 100644 index cb971d77a3..0000000000 --- a/tests/cypress/integration/features/platform/entity_reference_validation.feature +++ /dev/null @@ -1,18 +0,0 @@ -Feature: Entity Reference Validation - In order to confirm that entity reference fields are validated correctly - As an editor - I need Resources & Support content types to not allow duplicate references - - @entity_reference_validation - Scenario: Duplicate Benefit Hub references should not be allowed - Given I am logged in as a user with the "content_admin" role - And I create a "step_by_step" node - And I click the edit tab - And I select the "VA Careers and employment" benefits hub - And I wait "3" seconds - And I select the "VA Careers and employment" benefits hub - And I wait "3" seconds - And I fill in field with selector "#edit-revision-log-0-value" with value "[Test Data] Revision log message." - And I save the node - Then "1 error has been found" should exist - Then "The value Careers and employment" should exist From 67e6fe3a3e20550a5bf2be1e12380881de3098a6 Mon Sep 17 00:00:00 2001 From: Edmund Dunn Date: Thu, 21 Dec 2023 12:17:36 -0800 Subject: [PATCH 3/8] VACMS-16457: updated composer.lock --- composer.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.lock b/composer.lock index 6bf53c2ba6..c22eacc8ac 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": "64e595873f42dc18baa9eeaaa378e1b1", + "content-hash": "f6978b2b4609469a168d3f7a38d64bb5", "packages": [ { "name": "asm89/stack-cors", From 71e1805f607f4119133362b753f97e9db8ebda21 Mon Sep 17 00:00:00 2001 From: Edmund Dunn Date: Fri, 22 Dec 2023 07:27:47 -0800 Subject: [PATCH 4/8] VACMS-16457: update composer.lock --- composer.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.lock b/composer.lock index 3238101fc4..6c5b6b441b 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": "5387248818223379c16643f10fb25e74", + "content-hash": "5e062b1fcfcd98768fcb23b1199ca3b9", "packages": [ { "name": "asm89/stack-cors", From df5bca328fd84ae9332b5cdc47fae5fb5282e20f Mon Sep 17 00:00:00 2001 From: Edmund Dunn Date: Wed, 3 Jan 2024 12:28:05 -0800 Subject: [PATCH 5/8] VACMS-16457: updated composer.lock --- composer.lock | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/composer.lock b/composer.lock index 7383b3feb7..3b2fc9eb35 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": "86b64711dabe170d98620dd29d6984e3", + "content-hash": "12c6aa5fc6c1663eac6d06c0764b57ca", "packages": [ { "name": "asm89/stack-cors", @@ -2241,10 +2241,6 @@ "name": "dww", "homepage": "https://www.drupal.org/user/46549" }, - { - "name": "googletorp", - "homepage": "https://www.drupal.org/user/386230" - }, { "name": "jsacksick", "homepage": "https://www.drupal.org/user/972218" @@ -4973,6 +4969,10 @@ "homepage": "https://www.drupal.org/u/greg-boggs", "role": "Maintainer" }, + { + "name": "Greg Boggs", + "homepage": "https://www.drupal.org/user/153069" + }, { "name": "hmartens", "homepage": "https://www.drupal.org/user/622826" @@ -14376,12 +14376,9 @@ }, "require": { "php": "^8.0", - "php-http/client-implementation": "^1.0", - "php-http/discovery": "^1.6", - "php-http/httplug": "^1.0 || ^2.0", - "php-http/message-factory": "^1.0.2", - "psr/http-message": "^1.0 || ^2.0", - "psr/http-message-implementation": "^1.0", + "php-http/discovery": "^1.17", + "psr/http-client-implementation": "^1.0", + "psr/http-factory-implementation": "^1.0", "willdurand/geocoder": "^4.0" }, "require-dev": { @@ -14422,7 +14419,7 @@ "http geocoder" ], "support": { - "source": "https://github.com/geocoder-php/php-common-http/tree/master" + "source": "https://github.com/geocoder-php/php-common-http/tree/4.6.0" }, "time": "2023-07-31T20:07:24+00:00" }, From d2fc4882a9e187f48f0da5ca0f19d93c8432b4fb Mon Sep 17 00:00:00 2001 From: Edmund Dunn Date: Thu, 4 Jan 2024 13:13:17 -0800 Subject: [PATCH 6/8] VACMS-16457: updated composer.lock --- composer.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.lock b/composer.lock index 021592980f..46ea28936e 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": "5a7e58688f1c33c8227dff112b75d798", + "content-hash": "c69ccc419dea1fb2b0c80c7bf7c7c763", "packages": [ { "name": "asm89/stack-cors", From 8c92ef65d5788ddd1ef5650f7aad48a84cd84f9d Mon Sep 17 00:00:00 2001 From: Edmund Dunn Date: Fri, 5 Jan 2024 08:10:43 -0800 Subject: [PATCH 7/8] VACMS-16457: removed unneeded patch --- composer.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/composer.json b/composer.json index e115b407b0..d0034b7539 100644 --- a/composer.json +++ b/composer.json @@ -406,8 +406,7 @@ }, "drupal/entity_browser": { "2856138 - Entity browser cardinality validation": "https://www.drupal.org/files/issues/0001-Issue-2856138-by-gordon-Error-messages-are-not-being.patch", - "3191302 - Make modal iframe tab accessible": "https://www.drupal.org/files/issues/2021-01-07/3191302-3.patch", - "3408216 - Error: Call to a member function getStorage() on null": "https://www.drupal.org/files/issues/2023-12-21/3408216-error-call-to-member-function-getstorage-on-null.patch" + "3191302 - Make modal iframe tab accessible": "https://www.drupal.org/files/issues/2021-01-07/3191302-3.patch" }, "drupal/entity_browser_table": { "3194622 - Custom field validation should not be applied to remove button": "https://www.drupal.org/files/issues/2021-01-25/limit-remove-button-validators.patch", From 5a5b02f3d0a5c8ebd08654794f749a61dfb305e0 Mon Sep 17 00:00:00 2001 From: Edmund Dunn Date: Fri, 5 Jan 2024 08:41:32 -0800 Subject: [PATCH 8/8] VACMS-16457: removed unneeded patch --- ...o-member-function-getstorage-on-null.patch | 36 ------------------- 1 file changed, 36 deletions(-) delete mode 100644 patches/3408216-error-call-to-member-function-getstorage-on-null.patch diff --git a/patches/3408216-error-call-to-member-function-getstorage-on-null.patch b/patches/3408216-error-call-to-member-function-getstorage-on-null.patch deleted file mode 100644 index 05cd72c4d7..0000000000 --- a/patches/3408216-error-call-to-member-function-getstorage-on-null.patch +++ /dev/null @@ -1,36 +0,0 @@ -diff --git a/src/Plugin/Field/FieldWidget/EntityReferenceBrowserWidget.php b/src/Plugin/Field/FieldWidget/EntityReferenceBrowserWidget.php -index 13df19e50ae44393a651c46a0524065d0c29c921..f9df033be5e7a0d616105ff8f2f69f756a366af7 100644 ---- a/src/Plugin/Field/FieldWidget/EntityReferenceBrowserWidget.php -+++ b/src/Plugin/Field/FieldWidget/EntityReferenceBrowserWidget.php -@@ -835,7 +835,31 @@ class EntityReferenceBrowserWidget extends WidgetBase { - } - } - return $entities; -+ }foreach ($stored_ids as $entity_id) { -+ if (isset($indexed_entities[$entity_id])) { -+ $entities[] = $indexed_entities[$entity_id]; -+ } -+ } -+ if (!empty($entities)) { -+ return $entities; -+ } -+ // We are loading for for the first time so we need to load any existing -+ // values that might already exist on the entity. Also, remove any leftover -+ // data from removed entity references. -+ else { -+ foreach ($items as $item) { -+ if (isset($item->target_id)) { -+ if (!is_null($entity_storage)) { -+ $entity = $entity_storage->load($item->target_id); -+ if (!empty($entity)) { -+ $entities[] = $entity; -+ } -+ } -+ } -+ } -+ return $entities; - } -+ - } - - /**