1.20.x config_file_storage.inc public ConfigFileStorage::encode($data)

Encodes configuration data into the storage-specific format.

Parameters

array $data: The configuration data to encode.

Return value

string: The encoded configuration data.

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

Overrides ConfigStorageInterface::encode

File

drivers/config_file/config_file_storage.inc, line 182

Class

ConfigFileStorage
Defines the file storage controller.

Code

public function encode($data) {
  $contents = backdrop_json_encode($data, TRUE);
  if ($contents === FALSE) {
    throw new ConfigStorageException(t('The configuration string could not be parsed.'));
  }
  return $contents;
}