You are here

public function JsonFileStorage::encode in Tome 8

Encodes configuration data into the storage-specific format.

This is a publicly accessible static method to allow for alternative usages in data conversion scripts and also tests.

Parameters

array $data: The configuration data to encode.

Return value

string The encoded configuration data.

Overrides FileStorage::encode

File

modules/tome_sync/src/JsonFileStorage.php, line 24

Class

JsonFileStorage
Defines the JSON file storage.

Namespace

Drupal\tome_sync

Code

public function encode($data) {
  return \Drupal::service('serializer')
    ->encode($data, 'json', [
    'json_encode_options' => JSON_PRETTY_PRINT,
  ]);
}