You are here

function _media_entity_snapshot_config in Media entity 8.2

Collects snapshots of config objects.

Parameters

string[] $names: The names of the config objects to snapshot.

bool $delete: (optional) Whether to delete the original config objects. Defaults to FALSE.

Return value

array The config data, keyed by object name.

1 call to _media_entity_snapshot_config()
media_entity_update_8201 in ./media_entity.install
Replace Media Entity with Media.

File

./media_entity.install, line 577
Install, uninstall and update hooks for Media entity module.

Code

function _media_entity_snapshot_config(array $names, $delete = FALSE) {
  $snapshots = [];
  foreach ($names as $name) {
    $config = \Drupal::configFactory()
      ->getEditable($name);
    if (!$config
      ->isNew()) {
      $snapshots[$name] = $config
        ->get();
      if ($delete) {
        $config
          ->delete();
      }
    }
  }
  return $snapshots;
}