Related: #2155465: Changed plugin/moduls moved, info doesn't change because it's stored in the settings array
(Technically it's not a bug, but it is a huge oversight IMO.)
Features are meant to be reusable, that's why they're features. But CKEDITOR features contain plugin meta data like this:
'webform_answers' => array(
'name' => 'webform_answers',
'desc' => 'Webform Answers',
'path' => '/sites/virenze/modules/ezhealth/client/custom/webform_answers/editors/ckeditor/',
'buttons' => array(
'webform_answers' => array(
'label' => 'Insert Webform Answer',
'icon' => 'webform_answers.png',
),
),
),
So the path is fixed, not just the module location, but the site too. Even the base path, but you can manually change that to %base_path%
. It would be awesome if the plugin's module directory was a placeholder too, so wherever the module lives, CKEDITOR can find the plugin files. Sometimes just the site location is enough, so you can reuse the feature (or entire site code base) for another site.
I propose to add:
%conf_path%
for site's location, and%plugin_module_path%
for the relevant plugin's module's location
Patch coming.
Comment | File | Size | Author |
---|---|---|---|
#34 | ckeditor-plugin_module_paths-2422875-34.patch | 3.81 KB | zipymonkey |
| |||
#28 | interdiff-11-28.txt | 7.55 KB | rudiedirkx |
#28 | ckeditor-plugin_module_paths-2422875-28.patch | 3.72 KB | rudiedirkx |
Comments
Comment #1
rudiedirkx CreditAttribution: rudiedirkx commentedComment #2
rudiedirkx CreditAttribution: rudiedirkx commentedComment #3
rudiedirkx CreditAttribution: rudiedirkx commentedComment #4
rudiedirkx CreditAttribution: rudiedirkx commentedComment #5
rudiedirkx CreditAttribution: rudiedirkx commentedThis is a way. But it only supports
%plugin_module_path%
for plugins provided byhook_ckeditor_plugin()
.Another (better) way would be if CKEDITOR saved the module path for every plugin, when it collects plugins, but that's more work. Maybe later.
Comment #6
rudiedirkx CreditAttribution: rudiedirkx commentedAlright, this is the right method. It's really weird CKEDITOR collects plugins like this...
Comment #7
rudiedirkx CreditAttribution: rudiedirkx commentedThe way simpler method that applies to 1.13 and dev is to only add
%conf_path%
, which is enough in my case.Comment #8
rudiedirkx CreditAttribution: rudiedirkx commentedThe one in #6 is the best way. That should get in.
Comment #9
discipolo CreditAttribution: discipolo commentedso i review the one from #6 and not #7 then?
Comment #10
rudiedirkx CreditAttribution: rudiedirkx commentedYes, do #6. It's the only one not hidden, but that's not very obvious.
#5 is weird. #7 is only for people with 1.13 (like me).
Comment #11
othermachines CreditAttribution: othermachines commented@rudiedirkx - Is the issue name OK? Looks like you went through at least a couple of iterations in your approach since you first posted.
There were some major changes committed today so I gave this a reroll. I'm not sure if it's what you intended, but this resolved my problem of errors that arise when two modules try to add the same plugin via hook_ckeditor_plugin(). I would like others to confirm this though.
If I'm right, this might qualify as a bug fix?
Thanks!
Comment #12
rudiedirkx CreditAttribution: rudiedirkx commentedThe issue really was about those placeholders in the plugin path. Not just about adding the relevant module for every plugin info. That was a necessary side effect.
I really need those placeholders, because my make files depend on them :-) and it's The Right Thing.
I could fix and reroll later next week, if necessary.
Comment #13
othermachines CreditAttribution: othermachines commentedA happy side effect. :) Apparently my brain checked out as I was following the thread. Issue status has been reverted.
Your changes from #6 have been rolled into #11 patch. What is it that needs fixing?
Now wondering if I should open a separate issue regarding aforementioned plugin conflicts and point it here. I would really like a fix for that in next release.
Comment #14
rudiedirkx CreditAttribution: rudiedirkx commentedhttp://cgit.drupalcode.org/block_usage/tree/block_usage.modules.inc
I'm on my phone in a dubious country so I can't see the interdiff between #6 and #11.
I'm not sure what the aforementioned plug-in problem is, but if it's about the weird contrib inclusion, I agree. But that's a big CKEditor issue and I really don't want to mix into there. It should work like {first link}
OMG fucking phone sucks ass.
Comment #15
rudiedirkx CreditAttribution: rudiedirkx commentedBTW, about your
> What is it that needs fixing?
If #6 and #11, you fixed it. I didn't see the patch (change) earlier. Stupid phone, stupid Internet, dubious connection, I'm not sure what's real anymore.
Comment #16
othermachines CreditAttribution: othermachines commentedHeh. No worries. I should've uploaded an interdiff, but it was just a reroll. I didn't fix anything, you did. Cheers and thanks -
Comment #17
discipolo CreditAttribution: discipolo commented#6 works great for me. #11 looks like its the same patch.
Comment #18
othermachines CreditAttribution: othermachines commented@discipolo Thanks! #11 is the same but rolled against latest -dev.
* edit: corrected username (oops)
Comment #19
mikran CreditAttribution: mikran at Mediamaisteri Oy commentedSo with this patch we can use
%plugin_module_path%
manually in features exports but is the an issue to make this the default?Edit: nevermind, that was different issue #2494925: Plugin path when drupal in subdir is wrong (again).
Comment #21
rudiedirkx CreditAttribution: rudiedirkx commented@mikran Yes, you have to do it manually =( (The full paths don't even belong in the export code IMO, but there they are.) Recreating the feature probably breaks it again.
I RTBC because #17 and personal experience.
Comment #22
jcisio CreditAttribution: jcisio at Axess Open Web Services commentedWe should add a change notice and ckeditor.api.php to have something like that:
From:
to:
Also maybe file an issue in each contrib module that implements hook_ckeditor_plugin() so that the export works better. Besides, in ckeditor_load_plugins() could we add some intelligence to replace hardcoded path with %plugin_module_path% if we detect the old pattern is used (only at position 0)?
Comment #23
rudiedirkx CreditAttribution: rudiedirkx commented@jcisio That would be a very good next step, but could be the NEXT step. This issue still fixes a valid problem. We can make more issues to fix it even better.
Comment #24
rudiedirkx CreditAttribution: rudiedirkx commentedModules (not projects) that have
ckeditor
as dependency:Comment #25
Nebel54The patch still applies and is used by us quite some time in production already. I agree with rudiedirkx that this issue can be commited already. Changing back to RTBC. Thanks for your great work!
Comment #26
jcisio CreditAttribution: jcisio at Axess Open Web Services commentedOk to defer the notice to other contrib modules. But I think change in ckeditor.api.php is necessary and not a huge change that worths a new issue.
I've just reviewed the patch again. I don't think we need the
'module' => 'ckeditor'
part, now all plugins are from the ckeditor module.Comment #27
rudiedirkx CreditAttribution: rudiedirkx commentedRelevant, but another issue: better tokens in Editor CSS and Styles JS paths.
I'll fix this patch this weekend. I use %conf_path% all the time.
Comment #28
rudiedirkx CreditAttribution: rudiedirkx commentedPrevious patch was broken. Not sure why. Module path replacement failed, because 'module' wasn't included in the renderable/token data anymore. Probably something changed in ckeditor.module with executing orders or something.
New patch:
%plugin_module_path%
tokenI like this a lot. If a module defines its plugin using
%plugin_module_path%
, it's automatically featurized like that, and reusable everywhere.%conf_path%
is still only manual. We could add a pre-featurize alter to add tokens to tokenless paths, but that would have to be another issue.The interdiff is so big because I could remove a lot from the previous patch.
My test plugin in
ck_plugin.module
:Comment #30
rudiedirkx CreditAttribution: rudiedirkx commentedI've no idea what's going on with the CI, but it's not the patch.
Comment #31
hass CreditAttribution: hass commentedComment #32
hass CreditAttribution: hass commentedSomeone added tests and now it's green.
Comment #33
rudiedirkx CreditAttribution: rudiedirkx commentedIf there are no tests, why is CI triggered? And even if it is, shouldn't no tests be an automatic pass..?
Green is Good!
Comment #34
zipymonkey CreditAttribution: zipymonkey commentedI found that the placeholders are not being replaced if they are added during hook_ckeditor_plugin_alter() calls. This is problematically specifically with the media_ckeditor module (http://cgit.drupalcode.org/media_ckeditor/tree/media_ckeditor.ckeditor.i...). I found that adding the adding
drupal_alter('ckeditor_plugin', $plugins);
inckeditor_plugins_render
fixes this, though I'm not sure this is the correct way to handle this.I've modified patch in #28 to do this.