public function DrupalEncrypt::configSchema in Backup and Migrate 8.4
Get a default (blank) schema.
Parameters
array $params: The parameters including:
- operation - The operation being performed, will be one of:
- 'backup': Configuration needed during a backup operation
- 'restore': Configuration needed during a restore
- 'initialize': Core configuration always needed by this item
Return value
array
Overrides ConfigurableTrait::configSchema
File
- src/
Filter/ DrupalEncrypt.php, line 26
Class
- DrupalEncrypt
- Class DrupalEncrypt.
Namespace
BackupMigrate\Drupal\FilterCode
public function configSchema($params = []) {
$schema = [];
// Backup configuration.
if ($params['operation'] == 'backup' || $params['operation'] == 'restore') {
if (class_exists('\\Defuse\\Crypto\\File')) {
$schema['groups']['encrypt'] = [
'title' => 'Backup Encryption',
];
$schema['fields']['encrypt'] = [
'group' => 'encrypt',
'type' => 'boolean',
'title' => $params['operation'] == 'backup' ? $this
->t('Encrypt File') : $this
->t('Decrypt file'),
'description' => $this
->t('Password for encrypting / decrypting the file'),
];
$schema['fields']['encrypt_password'] = [
'group' => 'encrypt',
'type' => 'password',
'title' => $params['operation'] == 'backup' ? $this
->t('Encryption Password') : $this
->t('Decryption Password'),
];
}
else {
drupal_set_message($this
->t('Please install the Defuse PHP-encryption library via Composer to be able to encrypt backup files.'), 'warning');
}
}
return $schema;
}