From 29bee06956ed87007f4016cf0a53e01eeabe725e Mon Sep 17 00:00:00 2001 From: Joel Steidl Date: Wed, 9 Oct 2024 21:41:54 -0600 Subject: [PATCH] adds a hook update to fix an issue --- .../pbc_automation/pbc_automation.install | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/web/modules/custom/pbc_automation/pbc_automation.install b/web/modules/custom/pbc_automation/pbc_automation.install index 5aa97f4..54d0c6b 100644 --- a/web/modules/custom/pbc_automation/pbc_automation.install +++ b/web/modules/custom/pbc_automation/pbc_automation.install @@ -5,6 +5,35 @@ * Contains pbc_automation.install. */ +/** + * Update obsolete entity action plugins to new definitions (workaround). + * + * See https://www.drupal.org/project/drupal/issues/3045570 + * + * Implements hook_update_N(). + */ +function pbc_automation_update_9001() { + $old_new_action_id_map = [ + 'node_publish_action' => 'entity:publish_action:node', + 'node_unpublish_action' => 'entity:unpublish_action:node', + 'node_save_action' => 'entity:save_action:node', + 'node_delete_action' => 'entity:delete_action:node', + 'comment_publish_action' => 'entity:publish_action:comment', + 'comment_unpublish_action' => 'entity:unpublish_action:comment', + 'comment_save_action' => 'entity:save_action:comment', + 'comment_delete_action' => 'entity:delete_action:comment', + ]; + + /** @var \Drupal\system\Entity\Action[] $actions */ + $actions = \Drupal::entityTypeManager()->getStorage('action')->loadMultiple(); + foreach ($actions as $action) { + if (isset($old_new_action_id_map[$action->id()])) { + $action->setPlugin($old_new_action_id_map[$action->id()]); + $action->save(); + } + } +} + /** * Update Group Attendance Field Values. */