1.20.x config_database_storage.inc public ConfigDatabaseStorage::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_database/config_database_storage.inc, line 278

Class

ConfigDatabaseStorage
Defines the database 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;
}