public static function ConfigBit::actionArchiveFiles in Varbase: The Ultimate Drupal CMS Starter Kit (Bootstrap Ready) 9.0.x
Same name and namespace in other branches
- 8.8 src/Config/ConfigBit.php \Drupal\varbase\Config\ConfigBit::actionArchiveFiles()
- 8.4 src/Config/ConfigBit.php \Drupal\varbase\config\ConfigBit::actionArchiveFiles()
- 8.5 src/Config/ConfigBit.php \Drupal\varbase\config\ConfigBit::actionArchiveFiles()
- 8.6 src/Config/ConfigBit.php \Drupal\varbase\config\ConfigBit::actionArchiveFiles()
- 8.7 src/Config/ConfigBit.php \Drupal\varbase\config\ConfigBit::actionArchiveFiles()
Apply the action of archive files to the given config bit file.
Parameters
string $config_bit_file_name: The Config bit file name in the root configbit folder.
string $condition_name: The Condition name in the config bit file.
string|bool $condition_value: The Condition value for the condition name in the config bit file.
string $type: The type of profile.
string $project: The project.
File
- src/
Config/ ConfigBit.php, line 692
Class
- ConfigBit
- Class ConfigBit.
Namespace
Drupal\varbase\ConfigCode
public static function actionArchiveFiles($config_bit_file_name, $condition_name, $condition_value, $type = 'profile', $project = 'varbase') {
$config_bit_data = ConfigBit::getConfigBit($config_bit_file_name, $type, $project);
if (isset($config_bit_data['type']) && ($config_bit_data['type'] = 'action' && isset($config_bit_data['action']) && isset($config_bit_data['action']['archive_files']) && isset($config_bit_data['action']['archive_files']['when']) && isset($config_bit_data['action']['archive_files']['when'][$condition_name]) && $config_bit_data['action']['archive_files']['when'][$condition_name] == $condition_value && isset($config_bit_data['action']['archive_files']['files']))) {
foreach ($config_bit_data['action']['archive_files']['files'] as $language_config_file) {
$config_file = drupal_get_path($type, $project) . '/' . $language_config_file;
if (file_exists($config_file)) {
$config_file_backup = $config_file . $config_bit_data['action']['archive_files']['archive_extensiton'];
\Drupal::service('file_system')
->move($config_file, $config_file_backup);
}
}
}
}