You are here

function profile_post_update_add_revision_settings in Profile 8

Add new revision settings to profile types.

File

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

Code

function profile_post_update_add_revision_settings() {

  /** @var \Drupal\profile\Entity\ProfileType[] $profile_types */
  $profile_types = ProfileType::loadMultiple();
  foreach ($profile_types as $profile_type) {
    if ($profile_type
      ->get('use_revisions')) {
      $profile_type
        ->set('allow_revisions', TRUE);
      $profile_type
        ->set('new_revision', TRUE);
      $profile_type
        ->save();
    }
  }
}