What is the advised way of giving a path for getFile to find your plugin file if the plugin is in the /libraries folder outside of core? See: #2756597: Plugin path should not provide leading slash
Initially I gave it a path, and then there was a report about it not working correctly for installations in a subfolder. So I fixed that, and then the above issue pops up. What is the advised way to define a path to the plugin file that works in all scenarios?
Comments
Comment #2
kevinquillen commentedComment #3
darol100 commentedComment #5
wim leersFirst: there is no such thing as an official
/librariesfolder next to the/corefolder. Of course it's fine to do that.Second: the documentation says this:
i.e. what is returned must be Drupal root-relative.
Third: looking at the first example I find in core, at
\Drupal\ckeditor\Plugin\CKEditorPlugin\DrupalImage::getFile():If you run this, you get:
No matter if Drupal is installed in a subdirectory or not. That's why it's "Drupal root-relative".
So, both the before and after listed in #2729087: Path to plugin is incorrect unless base path is "/" are wrong. Because both have a leading slash, and that means it's not Drupal root-relative; it's relative to the actual root of the file system. What you need, is
libraries/a/b/c/file.js.