Skip to content

Commit

Permalink
adds a hook update to fix an issue
Browse files Browse the repository at this point in the history
  • Loading branch information
joelsteidl committed Oct 10, 2024
1 parent b8b13f5 commit 29bee06
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions web/modules/custom/pbc_automation/pbc_automation.install
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down

0 comments on commit 29bee06

Please sign in to comment.