public function FileNamer::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
- lib/
backup_migrate_core/ src/ Filter/ FileNamer.php, line 24
Class
- FileNamer
- Class FileNamer.
Namespace
BackupMigrate\Core\FilterCode
public function configSchema($params = []) {
$schema = [];
if (\Drupal::moduleHandler()
->moduleExists('token')) {
$must_match = '/^[\\w\\-_:\\[\\]]+$/';
$must_match_err = $this
->t('%title must contain only letters, numbers, dashes (-) and underscores (_). And Site Tokens.');
}
else {
$must_match = '/^[\\w\\-_:]+$/';
$must_match_err = $this
->t('%title must contain only letters, numbers, dashes (-) and underscores (_).');
}
// Backup configuration.
if ($params['operation'] == 'backup') {
$schema['groups']['file'] = [
'title' => 'Backup File',
];
$schema['fields']['filename'] = [
'group' => 'file',
'type' => 'text',
'title' => 'File Name',
'must_match' => $must_match,
'must_match_error' => $must_match_err,
'min_length' => 1,
// Allow a 200 character backup name leaving a generous 55 characters
// for timestamp and extension.
'max_length' => 200,
'required' => TRUE,
];
$schema['fields']['timestamp'] = [
'group' => 'file',
'type' => 'boolean',
'title' => 'Append a timestamp',
];
$schema['fields']['timestamp_format'] = [
'group' => 'file',
'type' => 'text',
'title' => 'Timestamp Format',
'max_length' => 32,
'dependencies' => [
'timestamp' => TRUE,
],
'description' => $this
->t('Use <a href="http://php.net/date">PHP Date formatting</a>.'),
];
}
return $schema;
}