- 🇨🇿Czech Republic Bohus Ulrych Pilsen (Czechia)
Hello @nitrocad,
thank you for patch #11 - it works.Still my problem with private files remains (see #4), previously related to file_create_url(), but still the same for \Drupal::service('file_url_generator').
You can try this:
$uri = 'public://'; $absolute = \Drupal::service('file_url_generator')->generateAbsoluteString($uri);
This will work.
But when you use private scheme$uri = 'private://';
You will get an error:
Parameter "filepath" for route "system.private_file_download" must match ".+" ("" given) to generate a corresponding URL.
My dirty hack from #8 still works. And I found this similar issue with very similar hack https://www.drupal.org/project/imce/issues/3371499 🐛 Parameter "filepath" for route "system.private_file_download" must match ".+" Fixed
With this patch for replacing filefield_paths in the text field, I have one more problem. I'm using save_edit module; but this is not problem of the module, but the approach. Idea is to save node and return back to the node edit page/form.
I created simple hook_form_alter() where I'm calling my custom submit function, with redirect back to the node edit page
$form_state->setRedirectUrl($url)
But this way, in the Ckeditor is displayed old, /system/files/filefield_paths/... path. But field it self, if I will check database or dump this field, is already using replaced path /system/files/replaced_path... ! If I click on the node edit link (or reload the page), then suddenly correct replaced variant is there.
Do you have any idea what is happening and how to solve it?
Thanks