Drupal 8.8.0-dev fresh install
Installed the module, run the code analysis, then when I access add module ( /admin/config/development/module_builder/add ) I get:
The website encountered an unexpected error. Please try again later.
TypeError: Argument 1 passed to Drupal\Component\Utility\NestedArray::getValue() must be of the type array, null given, called in drupal\modules\contrib\module_builder\src\Form\ComponentSectionForm.php on line 221 in Drupal\Component\Utility\NestedArray::getValue() (line 69 of core\lib\Drupal\Component\Utility\NestedArray.php).
This is happening because: $this->moduleEntityData = $module->get('data') ?? []; is using the magic __set method from Drupal\Core\Entity\EntityForm that is not actually setting anything. This might be an issue in EntityForm
The fix will be to declare the property $moduleEntityData inside the class to be sure it is initialized without the __set method.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | moduleEntityData_error-3093329-3.patch | 452 bytes | aalin |
Comments
Comment #2
aalin commentedpatch added
Comment #3
aalin commentedplease ignore the previous patch
Comment #5
joachim commentedWow, thank you so much for figuring that out! The thing with the magic methods looks like something that could have taken me ages to get to the bottom of!
Committed the patch with a docs formatting tweak.
Comment #6
joachim commentedI've filed #3094913: EntityForm's use of magic setter/getter breaks any subclasses that don't declare a property on core.
Thanks again!