Closed (fixed)
Project:
Drupal core
Version:
8.3.x-dev
Component:
editor.module
Priority:
Major
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
23 Aug 2014 at 22:45 UTC
Updated:
3 Nov 2016 at 12:44 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
tim.plunkettLet's see if PHPStorm got everything
Comment #3
tim.plunkettNot too shabby.
Comment #4
jibranI am only able to find minor issue.
Unrelated. Revert this please.
What about all the documentation we are removing form the
EditorPluginInterfaceandImageToolkitInterface?Comment #5
jibranI'd suggest we should ping maintainers of these two component for this change.
PS: I mean Editor and Image maintainers not Plugin maintainer :D
Comment #6
tim.plunkett#2096703: Image toolkits should use PluginFormInterface and ContainerFactoryPluginInterface is handling image toolkits directly.
Removed image and unrelated ckeditor hunks.
Comment #7
wim leersPluginFormInterfacewas added August 1, 2013.EditorPluginInterfacewas added January 16, 2013.That's why.
#5: thanks :)
This is lost.
This is also lost.
And this also introduces a subtle but important conflict. Everything used to be consistently named "settings": in the code, in the interface (
getDefaultSettings()) and in the config entity. This patch removes that consistency. That's acceptable, but it's definitely a subtle regression.I think we should consider renaming everything from "settings" to "configuration" for consistency.
Also lost.
Comment #8
wim leersComment #9
wim leersComment #10
Hjarnmastara commentedAdded the lost comments (see: #7).
Reworked everything to configuration instead of settings to keep the consistency.
Added type-hinting to the plugin generated by the plugin manager in Editor.php (see line 85 - 86).
Comment #12
wim leersTests are failing because
\Drupal\Tests\editor\Unit\EditorConfigEntityUnitTesthasn't been updated yet. Could you please also update that unit test?s/settings/configuration/ several times here.
This would also cause a hook name to be changed, hence we'll have to update its documentation in
editor.api.phpas well.Comment #13
harshil.maradiya commentedComment #14
harshil.maradiya commentedI have implement all changes which are mention (editor-2326721-7.patch)
Comment #15
harshil.maradiya commentedComment #17
wim leersThe patch doesn't apply to the latest version of Drupal 8. Apply it to your local version, or if you're using a branch, switch to that. Then, you can do
git pull --rebaseto bring it to the latest version. Then you can just recreate the patch file and upload it :)Comment #18
yesct commentedtags can be confusing.
Thank you for working on this issue.
Note, tags should be separated with a comma, not a space.
The Queue tag was used to line up issues before the sprint. (#2407325: preparing for a sprint, would be good to have a list of candidate issues)
When you work on an issue please add: SprintWeekend2015 (note, no @ or # at the beginning) according to that and https://groups.drupal.org/node/447258
Comment #19
harshil.maradiya commented@Wim Leers
Thanks will update and recreate the patch
Comment #20
harshil.maradiya commentedcreate patch with latest code
Comment #21
harshil.maradiya commentedComment #23
wim leersComment #24
harshil.maradiya commentedre verifying and uploading new patch
Comment #25
harshil.maradiya commentedComment #29
wim leersThe fatal:
PHP Fatal error: Unsupported operand types in /var/lib/drupaltestbot/sites/default/files/checkout/core/modules/editor/src/Entity/Editor.php on line 84Comment #30
subhojit777Comment #31
subhojit777- Test was using wrong method.
- Few indentation correction.
- Commented codes removed.
Comment #35
subhojit777Comment #36
subhojit777Comment #38
subhojit777Comment #40
subhojit777Comment #42
subhojit777Any idea why it is failing with unsupported operand types error. According to the patch in #40 the function
getDefaultSettings()has "only" been renamed togetDefaultConfiguration()(or is there something more in it?). Anyone please help!Comment #43
subhojit777$this->settingsand$plugin->getDefaultConfiguration()both are of array types too.Comment #44
subhojit777Uploading new patch with some minor fixes. I am still waiting for some help #42
Comment #46
wim leersWould love to help with #42, but the patch doesn't apply anymore. If you can get another working test run, I'll try to help :)
Comment #47
rpayanmTrying.
Comment #49
tim.plunkettI realize it was wrong in HEAD, but @see for methods should have () and cannot have a trailing .
These should be `public`.
Comment #50
rpayanm@tim.plunkett thank you for review this :)
Here the patch.
Comment #52
wim leersGreat! Now let's make the test green :)
The cause of the fatal:
So either
$this->settingsis not an array, or whatever$plugin->getDefaultConfiguration()is returning is not an array.Comment #53
rpayanmLet me see something first.
Comment #56
rpayanmThere is a error in
core/modules/editor/tests/src/Unit/EditorConfigEntityUnitTest::testCalculateDependencies()line 115 when:
Because in core/modules/editor/src/Entity/Editor::__construct(), $plugin->getDefaultConfiguration() isn't a array, seem it is NULL.
Comment #59
vijaycs85Isn't it because of the method rename?
Comment #61
vijaycs85getDefaultConfiguration()called more than once...Comment #63
rpayanmComment #64
tim.plunkettWhy do we need this check?
Comment #65
rpayanm@tim.plunkett because the patch fail due $plugin->getDefaultConfiguration() sometime is NULL.
Look this tests:
Tip:
The error more concise: 2326721-65-2-do-not-test.patch
Comment #66
rpayanmUps sorry is test-only.
Comment #67
rpayanmComment #69
rpayanmUmm my mistake :)
#64 suggest.
Comment #70
tim.plunkettAFAIK getDefaultConfiguration is documented as always returning an array. So we should remove the check and fix whatever plugin is returning NULL.
Comment #71
rpayanmAlready #69 patch resolve that.
Comment #72
xanoThis is a nice improvement :) I only found some minor naming and documentation issues:
If we are renaming this method anyway, we can fix the capitalization error at the same time:
JS>Js.I don't know if it's required, but I would add a bit more context to this, as the documentation in this form refers to a global function. Something like
@see self::getJSConfiguration()would work.Missing namespace.
Comment #73
Hjarnmastara commentedApplied the minor changes.
Comment #74
xanoThanks! Could you post an interdiff as well?
Comment #75
Hjarnmastara commentedDone!
I couldn't understand your comment about the missing namespace tho.
Comment #76
xanoThanks for the interdiff. It looks good!
When we refer to classes or interfaces in code comments, the Drupal coding standards require that we include the namespace as well, so we must use
@param \Drupal\ckeditor\Plugin\Editor\CKEditorinstead of justCKEditor, for example. Other coding standards sometimes allow developers to leave out the namespace, but we don't.Comment #77
sher1 commentedThe interdiff doesn't have the namespacing but the patch file does.
Comment #78
tim.plunkettComment #79
alexpottThis issue is a task so we need to outline how it fits within the allowable Drupal 8 beta criteria. Can someone add Drupal 8 beta phase evaluation template to the issue summary.
Lets update the test method name too.
Comment #80
wim leersComment #81
xanoRe-roll.
I'll post another patch that cleans up a few more things.
Comment #82
xanoThere's more we can improve, but for now I only improved the lines that were touched by the previous patch anyway.
Comment #83
wim leersThanks!
Comment #87
daffie commentedBack to RTBC.
Comment #88
xjmThanks for the patch and for keeping this issue going.
Thanks also for adding the beta evaluation. Unfortunately though, it is not correct -- this is definitely not unfrozen. Unfrozen changes are only:
In general, on its own, "replacing legacy code with best practices" is not an allowed change during the Drupal 8 beta. Review https://www.drupal.org/core/beta-changes. This patch does also introduce BC breaks that could impact existing implementations. I checked with @Wim Leers and he suggested that it also wouldn't really make sense to try to do this in a non-BC-breaking way in a minor release. So, I am postponing this issue to 9.x. Thanks everyone!
Comment #89
xjm(Removing the unfrozen line from the summary to avoid future confusion and adding reviewer credit.)
Comment #90
catchI think we should consider a bc-compatible patch here for a late release of 8.x - while it wouldn't make things clearer, it might allow 9.x compatible cod to be written in 8.x
Comment #91
wim leersLet's see if we can such a BC-compatible patch done then.
Comment #92
gnugetNot sure if the Novice and the php-novice tags are still valid for this issue, can we remove them?
Comment #93
wim leersGood point!
Comment #96
wim leersWe cannot do this in a BC-compatible way. Only in a half-BC-compatible way: we could change
\Drupal\editor\Plugin\EditorPluginInterfaceto let it extendPluginFormInterface, but then all implementations of that interface will cease to work. We can "automatically fix" any implementations that extendEditorBaseby lettingEditorBaseimplement thePluginFormInterfacemethods, but then that'd mean letting that base class redirect all the "proper" method implementations to the "bad" (current) ones. Otherwise it's still a BC break. But then we're effectively encouraging incorrect implementations!So, AFAICT there's no way to make this change in a BC-compatible way. In other words, I think this can only happen in D9.
Comment #97
catchThis would allow modules to update to the new interface though right? In which case I think it's worthwhile in 8.x, albeit ugly. If 9.x only drops backwards compatibility with 8.x, then we need to get our heads around problems like this.
Comment #98
wim leersLike this?
Comment #99
wim leersNote that the lack of changes to
EditorBasesubclasses proves that this maintains BC.Comment #100
wim leersTODO: look into whether https://www.drupal.org/node/2774077 affects this or not.
Comment #101
catchThat looks right to me.
Comment #102
wim leersThen I think this is ready to be committed.
Comment #103
wim leersComment #104
catchSo we should ideally @trigger_error('...', E_USER_DEPRECATED) in the bc methods on the base class, that will encourage people to implement the interface properly. As well as adding test coverage (i.e. a test subclass that doesn't have those methods) so we can confirm the bc layer works per #2575081: [policy, no patch] Use E_USER_DEPRECATED in Drupal 8 minor releases.
Comment #105
tim.plunkettThis should be using SubformState, see
\Drupal\block\BlockForm::form()for an example of doing that. Or I can help with the conversion.Or is that a separate issue? Hmm.
Comment #106
wim leersI wasn't sure about that either.
SubFormStateis so very new. This used to work just fine. So I think adoptingSubFormStateshould be a separate issue. This issue is already more than 100 comments long. AdoptingSubFormStateshould be less tricky and controversial, because it is solely internal refactoring.Comment #107
tim.plunkettAgreed, opened #2819731: Text Editor plugins are coupled to editor_form_filter_format_form_alter()
This just needs a CR, the code is RTBC.
Comment #108
wim leers#104: done.
Comment #109
wim leersCR created: https://www.drupal.org/node/2819753.
Comment #110
tim.plunkettInterdiff checks out. Thanks @Wim Leers!
Comment #111
tim.plunkettPreviously, the $editor was passed to settingsForm(), which declared it as a required parameter.
This implementation of buildConfigurationForm() should declare $editor as an optional parameter. It can't pull it from $form_state->get(), because nothing ever set it.
Sorry for missing this initially.
Comment #112
wim leersIf this didn't work, then we'd have several failing tests for the CKEditor test coverage.
It's
\editor_form_filter_admin_format_editor_configure()that sets it.Comment #113
tim.plunkettAha, reading the larger context made this clearer. This whole hunk in editor.module *only runs* if
$form_state->get('editor')returns something.Passing it along to buildConfigurationForm isn't needed, and it threw me off.
Removing that since everything already uses $form_state->get('editor'), and even though that is a little non-standard, it works fine and is needed by other parts of the code.
Comment #114
wim leersExcellent catch, that was indeed a small oversight on my part :)
Thanks for the reroll & explanation!
Comment #116
catchCommitted aed10c0 and pushed to 8.3.x. Thanks!
Nice to rescue this from 9.x purgatory.
Comment #117
wim leersCool :) AFAIK this is the first patch of its kind! Hopefully it's a solid precedent.
Publishing CR & unpostponing follow-up.