Pasar al contenido principal

Undefined variable: optional_details in easy_install_form_alter() (line 58 of modules/easy_install/easy_install.module).

Drupal Project
Module Version
8.x-10.5
Drupal Version
9.3.0-rc1
Comment

robertoguzman@…

Vie, 10/12/2021 - 01:22

la solución a este error se encuentra aca https://www.drupal.org/project/easy_install/issues/3161331

Y se usa la siguiente corrección

From c882892688ee840a1807f819418962405aa984c4 Mon Sep 17 00:00:00 2001
From: Pavel Filinkov <info@filinkov.ru>
Date: Sat, 25 Jul 2020 00:12:28 +0500
Subject: [PATCH] Solution of the error is not defined $optional_details

---
 easy_install.module | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/easy_install.module b/easy_install.module
index 1d3ca8f..8be5244 100644
--- a/easy_install.module
+++ b/easy_install.module
@@ -9,7 +9,6 @@ use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Url;
 use Drupal\Core\Config\InstallStorage;
 use Drupal\Core\Routing\RouteMatchInterface;
-Use \Drupal\Core\File\FileSystemInterface;
 
 /**
  * Implements hook_form_alter().
@@ -25,7 +24,7 @@ function easy_install_form_alter(&$form, FormStateInterface $form_state, $form_i
       $optional_dir = drupal_get_path('module', $module) . '/' . InstallStorage::CONFIG_OPTIONAL_DIRECTORY;
       if(file_exists($install_dir)) {
           $install_details = \Drupal::service('file_system')->scanDirectory($install_dir, "/\.(yml)$/");
-      }    
+      }
       if (!empty($install_details)) {
         $form['modules_config'][$module] = [
           '#type' => 'details',
@@ -51,9 +50,10 @@ function easy_install_form_alter(&$form, FormStateInterface $form_state, $form_i
             '#validated' => TRUE,
           ];
         }
+        $optional_details = [];
         if(file_exists($optional_dir)) {
             $optional_details = \Drupal::service('file_system')->scanDirectory($optional_dir, "/\.(yml)$/");
-        }    
+        }
         $opt_options = [];
         foreach ($optional_details as $config_value) {
           $opt_options[$config_value->name] = $config_value->name;
-- 
2.26.2.windows.1