action.post_update.php 847 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. /**
  3. * @file
  4. * Post update functions for Action module.
  5. */
  6. use Drupal\Core\Config\Entity\ConfigEntityUpdater;
  7. use Drupal\system\ActionConfigEntityInterface;
  8. /**
  9. * Moves action plugins to core.
  10. */
  11. function action_post_update_move_plugins(&$sandbox = NULL) {
  12. $resave_ids = [
  13. 'action_goto_action',
  14. 'action_message_action',
  15. 'action_send_email_action',
  16. ];
  17. \Drupal::classResolver(ConfigEntityUpdater::class)->update($sandbox, 'action', function (ActionConfigEntityInterface $action) use ($resave_ids) {
  18. // Save entity to recalculate dependencies.
  19. return $action->isConfigurable() && in_array($action->getPlugin()->getPluginId(), $resave_ids, TRUE);
  20. });
  21. }
  22. /**
  23. * Removes action settings.
  24. */
  25. function action_post_update_remove_settings() {
  26. \Drupal::configFactory()->getEditable('action.settings')->delete();
  27. }