Skip to content

Commit

Permalink
Issue #3277336: Switch the default Drupal Core from ~9.5.0 to ~10.0.0…
Browse files Browse the repository at this point in the history
… on the 10.0.x branch in Varbase Profile
  • Loading branch information
Natshah committed Feb 28, 2023
1 parent 1c435d0 commit 1dab808
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
22 changes: 11 additions & 11 deletions src/Config/ConfigBit.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ protected function processConfigBits(array $supportedConfigType, Config $saved_c
$token_variant = $this->configFactory->getEditable($saved_config_name)->get($supportedConfigType['token_variant']);

// Have the config template file name.
$config_template_file = DRUPAL_ROOT . '/' . drupal_get_path('profile', 'varbase') . '/configbit/varbase_config_templates/' . $supportedConfigType['config_template_file'];
$config_template_file = DRUPAL_ROOT . '/' . \Drupal::service('extension.list.profile')->getPath('varbase') . '/configbit/varbase_config_templates/' . $supportedConfigType['config_template_file'];

if (file_exists($config_template_file)) {
// Get config file contents.
Expand Down Expand Up @@ -599,7 +599,7 @@ protected function targetConfigExpectedNotToHaveIndex(array $config_action, arra
public static function getConfigBit($config_bit_file_name, $type = 'profile', $project = 'varbase') {

// Generate full path to config file.
$full_config_bit_file_name = drupal_get_path($type, $project) . '/' . $config_bit_file_name;
$full_config_bit_file_name = \Drupal::service('extension.list.' . $type)->getPath($project) . '/' . $config_bit_file_name;
if (file_exists($full_config_bit_file_name)) {
// Pars the config bit file and have it as an array if it was not.
$config_bit_data = (array) Yaml::parse(file_get_contents($full_config_bit_file_name));
Expand Down Expand Up @@ -630,7 +630,7 @@ public static function getConfigBit($config_bit_file_name, $type = 'profile', $p
*/
public static function doWeHaveThisConfigBit($config_bit_file_name, $type = 'profile', $project = 'varbase') {
// Generate full path to config file.
$full_config_bit_file_name = drupal_get_path($type, $project) . '/' . $config_bit_file_name;
$full_config_bit_file_name = \Drupal::service('extension.list.' . $type)->getPath($project) . '/' . $config_bit_file_name;
return file_exists($full_config_bit_file_name);
}

Expand Down Expand Up @@ -702,7 +702,7 @@ public static function actionArchiveFiles($config_bit_file_name, $condition_name
&& 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;
$config_file = \Drupal::service('extension.list.' . $type)->getPath($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);
Expand Down Expand Up @@ -737,7 +737,7 @@ public static function actionUnArchiveFiles($config_bit_file_name, $condition_na
&& isset($config_bit_data['action']['unarchive_files']['files'])) {

foreach ($config_bit_data['action']['unarchive_files']['files'] as $language_config_file) {
$config_file = drupal_get_path($type, $project) . '/' . $language_config_file;
$config_file = \Drupal::service('extension.list.' . $type)->getPath($project) . '/' . $language_config_file;
$config_file_backup = $config_file . $config_bit_data['action']['unarchive_files']['archive_extensiton'];
if (!file_exists($config_file) && file_exists($config_file_backup)) {
\Drupal::service('file_system')->move($config_file_backup, $config_file);
Expand Down Expand Up @@ -769,7 +769,7 @@ public static function actionAdd($config_bit_file_name, $condition_name, $condit
&& $config_bit_data['type'] == 'action'
&& isset($config_bit_data['for'])
&& !empty($config_bit_data['for'])
&& file_exists(drupal_get_path($type, $project) . '/' . $config_bit_data['for'])
&& file_exists(\Drupal::service('extension.list.' . $type)->getPath($project) . '/' . $config_bit_data['for'])
&& isset($config_bit_data['action'])
&& isset($config_bit_data['action']['add'])
&& isset($config_bit_data['action']['add']['when'])
Expand All @@ -779,7 +779,7 @@ public static function actionAdd($config_bit_file_name, $condition_name, $condit
&& $config_bit_data['action']['add']['target'] == $target
&& isset($config_bit_data['action']['add'][$target])) {

$config_target_data = Yaml::parse(file_get_contents(drupal_get_path($type, $project) . '/' . $config_bit_data['for']));
$config_target_data = Yaml::parse(file_get_contents(\Drupal::service('extension.list.' . $type)->getPath($project) . '/' . $config_bit_data['for']));

$configs_to_add = $config_bit_data['action']['add'][$target];
foreach ($configs_to_add as $config_to_add) {
Expand All @@ -792,7 +792,7 @@ public static function actionAdd($config_bit_file_name, $condition_name, $condit
$updated_config_target = Yaml::dump($config_target_data, 2, 2);

// Save the updated config to the target file.
file_put_contents(drupal_get_path($type, $project) . '/' . $config_bit_data['for'], $updated_config_target);
file_put_contents(\Drupal::service('extension.list.' . $type)->getPath($project) . '/' . $config_bit_data['for'], $updated_config_target);

}
}
Expand Down Expand Up @@ -820,7 +820,7 @@ public static function actionRemove($config_bit_file_name, $condition_name, $con
&& $config_bit_data['type'] == 'action'
&& isset($config_bit_data['for'])
&& $config_bit_data['for'] !== ''
&& file_exists(drupal_get_path($type, $project) . '/' . $config_bit_data['for'])
&& file_exists(\Drupal::service('extension.list.' . $type)->getPath($project) . '/' . $config_bit_data['for'])
&& isset($config_bit_data['action'])
&& isset($config_bit_data['action']['remove'])
&& isset($config_bit_data['action']['remove']['when'])
Expand All @@ -831,7 +831,7 @@ public static function actionRemove($config_bit_file_name, $condition_name, $con
&& isset($config_bit_data['action']['remove'][$target])) {

// Read the Yaml config file. which this config bit for.
$config_target_data = Yaml::parse(file_get_contents(drupal_get_path($type, $project) . '/' . $config_bit_data['for']));
$config_target_data = Yaml::parse(file_get_contents(\Drupal::service('extension.list.' . $type)->getPath($project) . '/' . $config_bit_data['for']));

$configs_to_remove = $config_bit_data['action']['remove'][$target];
foreach ($configs_to_remove as $config_to_remove) {
Expand All @@ -845,7 +845,7 @@ public static function actionRemove($config_bit_file_name, $condition_name, $con
$updated_config_target = Yaml::dump($config_target_data, 2, 2);

// Save the updated config to the target file.
file_put_contents(drupal_get_path($type, $project) . '/' . $config_bit_data['for'], $updated_config_target);
file_put_contents(\Drupal::service('extension.list.' . $type)->getPath($project) . '/' . $config_bit_data['for'], $updated_config_target);
}
}

Expand Down
10 changes: 5 additions & 5 deletions src/Form/AssemblerForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function __construct($root, InfoParserInterface $info_parser, Translation
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('app.root'),
$container->getParameter('app.root'),
$container->get('info_parser'),
$container->get('string_translation'),
$container->get('varbase.form_helper')
Expand Down Expand Up @@ -138,7 +138,7 @@ public function buildForm(array $form, FormStateInterface $form_state, array &$i
];

if (isset($extra_feature_info['formbit'])) {
$formbit_file_name = drupal_get_path('profile', 'varbase') . '/' . $extra_feature_info['formbit'];
$formbit_file_name = \Drupal::service('extension.list.profile')->getPath('varbase') . '/' . $extra_feature_info['formbit'];
if (file_exists($formbit_file_name)) {

include_once $formbit_file_name;
Expand Down Expand Up @@ -206,7 +206,7 @@ public function buildForm(array $form, FormStateInterface $form_state, array &$i
];

if (isset($demo_content_info['formbit'])) {
$formbit_file_name = drupal_get_path('profile', 'varbase') . '/' . $demo_content_info['formbit'];
$formbit_file_name = \Drupal::service('extension.list.profile')->getPath('varbase') . '/' . $demo_content_info['formbit'];
if (file_exists($formbit_file_name)) {

include_once $formbit_file_name;
Expand Down Expand Up @@ -257,7 +257,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {

if (isset($extra_feature_info['config_form']) &&
$extra_feature_info['config_form'] == TRUE) {
$formbit_file_name = drupal_get_path('profile', 'varbase') . '/' . $extra_feature_info['formbit'];
$formbit_file_name = \Drupal::service('extension.list.profile')->getPath('varbase') . '/' . $extra_feature_info['formbit'];
if (file_exists($formbit_file_name)) {

include_once $formbit_file_name;
Expand Down Expand Up @@ -295,7 +295,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {

if (isset($demo_content_info['config_form']) &&
$demo_content_info['config_form'] == TRUE) {
$formbit_file_name = drupal_get_path('profile', 'varbase') . '/' . $demo_content_info['formbit'];
$formbit_file_name = \Drupal::service('extension.list.profile')->getPath('varbase') . '/' . $demo_content_info['formbit'];
if (file_exists($formbit_file_name)) {

include_once $formbit_file_name;
Expand Down
2 changes: 1 addition & 1 deletion src/Form/ConfigureMultilingualForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function __construct($root, InfoParserInterface $info_parser, Translation
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('app.root'),
$container->getParameter('app.root'),
$container->get('info_parser'),
$container->get('string_translation'),
$container->get('varbase.form_helper'),
Expand Down
6 changes: 3 additions & 3 deletions src/Form/DevelopmentToolsAssemblerForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function __construct($root, InfoParserInterface $info_parser, Translation
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('app.root'),
$container->getParameter('app.root'),
$container->get('info_parser'),
$container->get('string_translation'),
$container->get('varbase.form_helper')
Expand Down Expand Up @@ -139,7 +139,7 @@ public function buildForm(array $form, FormStateInterface $form_state, array &$i
];

if (isset($development_tool_info['formbit'])) {
$formbit_file_name = drupal_get_path('profile', 'varbase') . '/' . $development_tool_info['formbit'];
$formbit_file_name = \Drupal::service('extension.list.profile')->getPath('varbase') . '/' . $development_tool_info['formbit'];
if (file_exists($formbit_file_name)) {

include_once $formbit_file_name;
Expand Down Expand Up @@ -188,7 +188,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {

if (isset($development_tool_info['config_form']) &&
$development_tool_info['config_form'] == TRUE) {
$formbit_file_name = drupal_get_path('profile', 'varbase') . '/' . $development_tool_info['formbit'];
$formbit_file_name = \Drupal::service('extension.list.profile')->getPath('varbase') . '/' . $development_tool_info['formbit'];
if (file_exists($formbit_file_name)) {

include_once $formbit_file_name;
Expand Down

0 comments on commit 1dab808

Please sign in to comment.