class JsonFileStorage in Tome 8
Defines the JSON file storage.
@internal
Hierarchy
- class \Drupal\Core\Config\FileStorage implements StorageInterface
- class \Drupal\tome_sync\JsonFileStorage
Expanded class hierarchy of JsonFileStorage
1 string reference to 'JsonFileStorage'
- tome_sync.services.yml in modules/
tome_sync/ tome_sync.services.yml - modules/tome_sync/tome_sync.services.yml
1 service uses JsonFileStorage
- tome_sync.storage.content in modules/
tome_sync/ tome_sync.services.yml - Drupal\tome_sync\JsonFileStorage
File
- modules/
tome_sync/ src/ JsonFileStorage.php, line 12
Namespace
Drupal\tome_syncView source
class JsonFileStorage extends FileStorage {
/**
* {@inheritdoc}
*/
public static function getFileExtension() {
return 'json';
}
/**
* {@inheritdoc}
*/
public function encode($data) {
return \Drupal::service('serializer')
->encode($data, 'json', [
'json_encode_options' => JSON_PRETTY_PRINT,
]);
}
/**
* {@inheritdoc}
*/
public function decode($data) {
return \Drupal::service('serializer')
->decode($data, 'json');
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FileStorage:: |
protected | property | The storage collection. | |
FileStorage:: |
protected | property | The filesystem path for configuration objects. | 1 |
FileStorage:: |
protected | property | The file cache object. | |
FileStorage:: |
public | function |
Creates a collection on the storage. Overrides StorageInterface:: |
1 |
FileStorage:: |
public | function |
Deletes a configuration object from the storage. Overrides StorageInterface:: |
2 |
FileStorage:: |
public | function |
Deletes configuration objects whose names start with a given prefix. Overrides StorageInterface:: |
1 |
FileStorage:: |
protected | function | Check if the directory exists and create it if not. | |
FileStorage:: |
public | function |
Returns whether a configuration object exists. Overrides StorageInterface:: |
2 |
FileStorage:: |
public | function |
Gets the existing collections. Overrides StorageInterface:: |
|
FileStorage:: |
protected | function | Helper function for getAllCollectionNames(). | |
FileStorage:: |
protected | function | Gets the directory for the collection. | |
FileStorage:: |
public | function |
Gets the name of the current collection the storage is using. Overrides StorageInterface:: |
|
FileStorage:: |
public | function | Returns the path to the configuration file. | 1 |
FileStorage:: |
private | function | Returns file system service. | |
FileStorage:: |
public | function |
Gets configuration object names starting with a given prefix. Overrides StorageInterface:: |
1 |
FileStorage:: |
public | function |
Implements Drupal\Core\Config\StorageInterface::read(). Overrides StorageInterface:: |
|
FileStorage:: |
public | function |
Reads configuration data from the storage. Overrides StorageInterface:: |
|
FileStorage:: |
public | function |
Renames a configuration object in the storage. Overrides StorageInterface:: |
1 |
FileStorage:: |
public | function |
Writes configuration data to the storage. Overrides StorageInterface:: |
1 |
FileStorage:: |
public | function | Constructs a new FileStorage. | 2 |
JsonFileStorage:: |
public | function |
Decodes configuration data from the storage-specific format. Overrides FileStorage:: |
|
JsonFileStorage:: |
public | function |
Encodes configuration data into the storage-specific format. Overrides FileStorage:: |
|
JsonFileStorage:: |
public static | function |
Returns the file extension used by the file storage for all configuration files. Overrides FileStorage:: |
|
StorageInterface:: |
constant | The default collection name. |