Commit b031332a authored by Alex Pott's avatar Alex Pott Committed by Jacob Rockowitz
Browse files

Issue #3250330 by alexpott: [Drupal 9.x] Remove usages of drupal_get_path()

parent 4aa9e84a
Loading
Loading
Loading
Loading
+2 −2
Changes for includes/webform.install.inc: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ function _webform_update_admin_settings($reset = FALSE) {
  $admin_config = \Drupal::configFactory()->getEditable('webform.settings');

  $current_settings = $admin_config->getRawData();
  $admin_settings = Yaml::decode(file_get_contents(drupal_get_path('module', 'webform') . '/config/install/webform.settings.yml'));
  $admin_settings = Yaml::decode(file_get_contents(__DIR__ . '/../config/install/webform.settings.yml'));
  // Note, admin settings are always grouped into associative array,
  // except for the langcode.
  foreach ($admin_settings as $group => $settings) {
@@ -294,7 +294,7 @@ function _webform_update_options_settings() {
 * Update or install any new system.actions.* config entities.
 */
function _webform_update_actions() {
  $files = \Drupal::service('file_system')->scanDirectory(drupal_get_path('module', 'webform') . '/config', '/^system.action..*\.yml$/');
  $files = \Drupal::service('file_system')->scanDirectory(__DIR__ . '/../config', '/^system.action..*\.yml$/');
  foreach ($files as $path => $file) {
    $action_id = str_replace('system.action.', '', $file->name);
    $action = Action::load($action_id);
+6 −6
Changes for includes/webform.install.update.inc: 6 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -418,7 +418,7 @@ function webform_update_8021() {

  // Get WebformOptions category from config/install.
  $webform_options = WebformOptions::loadMultiple();
  $config_install_path = drupal_get_path('module', 'webform') . '/config/install';
  $config_install_path = \Drupal::service('extension.list.module')->getPath('webform') . '/config/install';
  foreach ($webform_options as $id => $webform_option) {
    if (!$webform_option->get('category')) {
      if (file_exists("$config_install_path/webform.webform_options.$id.yml")) {
@@ -829,7 +829,7 @@ function webform_update_8039() {
  }

  // Remove 'webform_templates' dependency copied to new forms.
  $config_install_directory = drupal_get_path('module', 'webform_templates') . '/config/install';
  $config_install_directory = \Drupal::service('extension.list.module')->getPath('webform_templates') . '/config/install';
  $config_factory = \Drupal::configFactory();
  foreach ($config_factory->listAll('webform.webform.') as $webform_config_name) {
    $webform_config = $config_factory->getEditable($webform_config_name);
@@ -959,7 +959,7 @@ function webform_update_8045() {
function _webform_update_8045_is_submodule_config($webform_config_name) {
  $modules = WebformReflectionHelper::getSubModules();
  foreach ($modules as $module) {
    if (file_exists(drupal_get_path('module', $module) . "/config/install/$webform_config_name.yml")) {
    if (file_exists(\Drupal::service('extension.list.module')->getPath($module) . "/config/install/$webform_config_name.yml")) {
      return TRUE;
    }
  }
@@ -2105,7 +2105,7 @@ function webform_update_8113() {
 */
function webform_update_8114() {
  // Skip if the Contribute module still exists.
  if (file_exists(drupal_get_path('module', 'contribute') . '/contribute.info.yml')) {
  if (file_exists(\Drupal::service('extension.list.module')->getPath('contribute') . '/contribute.info.yml')) {
    return;
  }

@@ -2601,7 +2601,7 @@ function webform_update_8141() {
  // Copied from: redirect_update_8103()
  $message = NULL;
  if (\Drupal::moduleHandler()->moduleExists('views') && !View::load('webform_submissions')) {
    $config_path = drupal_get_path('module', 'webform') . '/config/optional/views.view.webform_submissions.yml';
    $config_path = \Drupal::service('extension.list.module')->getPath('webform') . '/config/optional/views.view.webform_submissions.yml';
    $data = ['uuid' => (new Uuid())->generate()] + WebformYaml::decode(file_get_contents($config_path));
    \Drupal::configFactory()->getEditable('views.view.webform_submissions')->setData($data)->save(TRUE);
    $message = 'The new webform submissions view has been created.';
@@ -3054,7 +3054,7 @@ function webform_update_8160() {
  // Remove nested calculation elements.
  $elements = WebformYaml::decode($config->get('elements'));
  if (isset($elements['calculation']) && isset($elements['calculation']['calculation'])) {
    $path = drupal_get_path('module', 'webform') . '/modules/webform_examples/config/install/webform.webform.example_computed_elements.yml';
    $path = \Drupal::service('extension.list.module')->getPath('webform') . '/modules/webform_examples/config/install/webform.webform.example_computed_elements.yml';
    $data = WebformYaml::decode(file_get_contents($path));
    $config->set('elements', $data['elements'])->save();
  }
+1 −1
Changes for modules/webform_bootstrap/tests/modules/webform_bootstrap_test_module/src/Controller/WebformBootstrapTestModuleController.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ class WebformBootstrapTestModuleController extends ControllerBase {
    ];
    $build = [];
    foreach ($style_guides as $style_guide) {
      $content = file_get_contents(drupal_get_path('module', 'webform_bootstrap_test_module') . '/style-guide/' . $style_guide . '.html');
      $content = file_get_contents(__DIR__ . '/../../style-guide/' . $style_guide . '.html');
      $build[$style_guide] = [
        '#markup' => Markup::create($content),
      ];
+1 −1
Changes for modules/webform_bootstrap/tests/modules/webform_bootstrap_test_module/webform_bootstrap_test_module.install: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -98,7 +98,7 @@ btn-lg';
 */
function webform_bootstrap_test_module_uninstall() {
  // Restore default container and button classes.
  $default_config = Yaml::decode(file_get_contents(drupal_get_path('module', 'webform') . '/config/install/webform.settings.yml'));
  $default_config = Yaml::decode(file_get_contents(__DIR__ . '/../../../../../config/install/webform.settings.yml'));
  \Drupal::configFactory()->getEditable('webform.settings')
    ->set('settings.form_classes', $default_config['settings']['settings']['form_classes'])
    ->set('settings.button_classes', $default_config['settings']['button_classes'])
+1 −1
Changes for modules/webform_devel/src/Commands/WebformDevelCommands.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ class WebformDevelCommands extends DrushCommands {
  public function drush_webform_devel_config_update() {
    module_load_include('inc', 'webform', 'includes/webform.install');

    $files = $files = \Drupal::service('file_system')->scanDirectory(drupal_get_path('module', 'webform'), '/^webform\.webform\..*\.yml$/');
    $files = \Drupal::service('file_system')->scanDirectory(__DIR__ . '/../../../../', '/^webform\.webform\..*\.yml$/');
    $total = 0;
    foreach ($files as $filename => $file) {
      try {
Loading