Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The current lookup for the font plugin relies on the Drupal base path being "/" so when the site is installed on a sub directory the plugin.js file cannot be found.
Comment | File | Size | Author |
---|---|---|---|
#15 | 2729087_ckeditor_font_file_path.patch | 605 bytes | AstonVictor |
#12 | 2729087-lib-issue-12.patch | 1010 bytes | darol100 |
#2 | better_libraries_path-2729087-3.patch | 603 bytes | sawtell |
Comments
Comment #2
sawtell CreditAttribution: sawtell commentedComment #4
darol100 CreditAttribution: darol100 as a volunteer and commented@ls206, Great work... Thank you for your contribution.
Comment #5
ckaotikThis actually causes problems with the core locale module. The core CKEditor plugins provide the
getFile
returns without the leading slash, such ascore/modules/ckeditor/js/plugins/drupallink/plugin.js
.The point where this creates trouble is then in
Warning: file_get_contents(/libraries/font/plugin.js): failed to open stream: No such file or directory in _locale_parse_js_file() (Line 1145 in /srv/www/htdocs/MYPROJECT/html/core/modules/locale/locale.module).
This happens when displaying the CKEditor right after a cache rebuild, and is due to locale trying to find embedded t() strings.The plugin works fine without the leading slash, but cause no further notices.
Comment #6
kevinquillen CreditAttribution: kevinquillen at Velir commentedI've started removing it from some of my modules, per https://www.drupal.org/node/2758579#comment-11562851
I think the difference is, the plugins core uses are packaged with core. Since we are integrating external plugins, we cannot pack it into contributed modules. I also do not want to depend on Libraries API, because that means everyone would have to - in which case, that might as well be in core itself.
I also think the edge case that is surfacing here is with sub folder installations and profile installations of Drupal. Some people are expressing the desire to have the libraries folder elsewhere in the Drupal directory (ex profiles/myprofile/libraries) - which I can see the use-case for but I do not know how to facilitate that request at the moment.
Comment #7
fkelly12054@gmail.com CreditAttribution: fkelly12054@gmail.com as a volunteer commentedLibraries seem all fouled up and inconsistent in Drupal 8.
I had to modify the path shown above (and in the patches) to:
public function getFile() {
// Make sure that the path to the plugin.js matches the file structure of
// the CKEditor plugin you are implementing.
return base_path().'sites/all/libraries/font/plugin.js';
}
With this modification and following the other instructions that come with this plugin I can make it work.
Comment #8
kevinquillen CreditAttribution: kevinquillen at Velir commentedIt's because there is no general consensus on how to handle them.
Comment #9
TheDucksLover CreditAttribution: TheDucksLover commentedThis "patch" works, but I'd rather like copying the FontCKEditorButton class to a custom module (eg : /modules/custom/ckeditor_font_custom/src/Plugin/CKEditorPlugin) and replace whatever needs to be replaced so you'll never touch the core module...
Comment #10
ckaotikAs @kevinquillen already stated, the proper solution was explained in #2758579: Best way for getFile to retrieve file(s) from the /libraries directory?:
The path is always relative to the Drupal root, and needs no
base_path
prefix.Comment #11
fkelly12054@gmail.com CreditAttribution: fkelly12054@gmail.com as a volunteer commentedHate to "disagree" with someone as expert as Leers. But the only thing working for me is to modify the php files in color button and panel button and ckeditor font to:
return base_path().'sites/all/libraries/xxxx/plugin.js
where xxxx is the module you are trying to get to work. If I do anything else, or I don't do it exactly right the textarea box within the content type I am trying to edit comes up blank.
Comment #12
darol100 CreditAttribution: darol100 as a volunteer and commentedHere is the patch for this issue. Base on @Wim Leers response to this issue - #5
Comment #13
darol100 CreditAttribution: darol100 as a volunteer and commentedThis issue is been fixed http://cgit.drupalcode.org/ckeditor_font/commit/?id=755eb3a.
Comment #15
AstonVictor CreditAttribution: AstonVictor at DevBranch commentedAdded a patch for 8.x-1.0.
Comment #16
freelylw CreditAttribution: freelylw commentedI am getting the same problem now after I install drupal by using the "web" template, please advise which file that I need to patch ? I don't see there is a "module" file in the folder, don't know which file I need to patch
Comment #17
joshmillerLooks like the latest release has a rewritten path function with a lot of follow ups. Appears to fix the initial problem.