Problem/Motivation
In Drupal 9, attempting to save the settings form located at /admin/commerce/pos/settings results in a fatal error:
Error: Call to undefined function Drupal\commerce_pos\Form\file_prepare_directory() in Drupal\commerce_pos\Form\CommercePOSSettingsForm->submitForm()
Steps to reproduce
- Install Commerce POS in Drupal 9
- Navigate to POS settings page at
/admin/commerce/pos/settings
- Make a change and attempt to save the page
You should see a fatal error.
Proposed resolution
As per https://www.palantir.net/rector/updating-deprecated-filepreparedirectory..., references to the deprecated file_prepare_directory() function should be replaced with \Drupal::service('file_system')->prepareDirectory($directory, $options);.
Remaining tasks
Test patch (coming in next comment)
User interface changes
None
API changes
None
Data model changes
None
Comments
Comment #2
amkloseHere's a patch that replaces the deprecated call in
CommercePOSSettingsForm.phpComment #3
amkloseChanging status.
Comment #4
ppblaauw commentedThe patch works for me
Comment #5
luksakWorks for me. Thank you!
Comment #6
_gramur commentedThis works for me as well.
Comment #7
alexpott