You are here

function custom_pub_update_8092 in Custom Publishing Options 8

Update to add new config dependency.

File

./custom_pub.install, line 48
Install and update function for Custom Publishing Options.

Code

function custom_pub_update_8092() {
  $entities = BaseFieldOverride::loadMultiple();
  foreach ($entities as $machine_name => $entity) {
    $custom_pub_entity = \Drupal::entityTypeManager()
      ->getStorage('custom_publishing_option')
      ->load($entity
      ->getName());
    if ($custom_pub_entity) {
      $dependencies = $entity
        ->get('dependencies');
      $dependencies['config'][] = $custom_pub_entity
        ->getConfigDependencyName();
      $entity
        ->set('dependencies', $dependencies);
      $entity
        ->save();
    }
  }
}