You are here

function profile_post_update_change_publish_action_plugins in Profile 8

Change the plugin IDs of the publish and unpublish actions.

File

./profile.post_update.php, line 30
Post update functions for Profile.

Code

function profile_post_update_change_publish_action_plugins() {
  $action_storage = \Drupal::entityTypeManager()
    ->getStorage('action');
  $publish_action = $action_storage
    ->load('profile_publish_action');
  if ($publish_action instanceof Action) {
    $publish_action
      ->setPlugin('entity:publish_action:profile');
    $publish_action
      ->save();
  }
  $unpublish_action = $action_storage
    ->load('profile_unpublish_action');
  if ($unpublish_action instanceof Action) {
    $unpublish_action
      ->setPlugin('entity:unpublish_action:profile');
    $unpublish_action
      ->save();
  }
}