Problem/Motivation
I am marking this as a bug in the documentation as without this the Id documentation for the CKEditorPlugin is incomplete and redundant.
Currently the only doc string for the core/modules/ckeditor/src/Annotation/CKEditorPlugin.php CKEditorPlugin.id is "The plugin ID."
This has two problems.
- It uses "ID" when it should be "Id"
- It is completely useless and redundant because the attribute name is "id" so it is obvious that we are defining an Id
Proposed resolution
There are actually some requirements for this attribute so we should have some documentation that points that out. I opened #3000962: [upstream] Improve JS error when a @CKEditorPlugin PHP plugin ID doesn't match the JS CKEditor plugin name to attempt to improve the errors that happen if this attribute isn't set correctly, but it also should be mentioned in the docs what those requirements are. As far as I know the only requirement is that the Id matches name declared to CKEditor in the JS.
Remaining tasks
Write doc patch.
User interface changes
none
API changes
none
Data model changes
none
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 3001029-3.patch | 725 bytes | wim leers |
| #2 | improve-ckeditor-plugin-annotation-doc-3001029-2.patch | 792 bytes | frob |
Comments
Comment #2
frobHere is a first pass at the patch to improve the documentation.
Comment #3
wim leersWe always write
IDin text/comments. We only writeIdin either PHP class names, PHP class method names or PHP class properties. I completely agree it's redundant and obvious but … that's what the documentation maintainers have decided, and so you'll see this for every plugin annotation class:\Drupal\quickedit\Annotation\InPlaceEditor\Drupal\rest\Annotation\RestResource\Drupal\Core\Layout\Annotation\Layout\Drupal\views\Annotation\ViewsRow+1! Your patch has some language and formatting issues. What do you think about the attached patch?
Comment #4
frobSorry about the whitespace errors, I guess I need to finish setting up vscode to delete that when I save.
I guess if there is nothing else there it is better than nothing, but in the case where the ID is actually used for something more than identification we should flesh those out a bit more. I have no idea which plugin annotation classes would need that and it seems like a pretty daunting task. But at least this one is getting some attention.
I don't think its as informative or verbose as what I wrote, but it still gets the job done. Mine is a bit too wordy.
I would mark this as RTBC, but since I wrote the initial patch I am not sure I should.
Comment #5
wim leersI agree yours was a bit too wordy :) Didn't want to spend too many words on that wordiness, hence I just made a counterproposal. Hope you don't mind!
You reported the confusion initially, so if you think that my alternative proposed documentation still addresses the confusion, then I think you're totally allowed to RTBC this :)
Comment #6
frobDone! RTBCed then :)
Comment #7
wim leers🎉
Comment #9
lauriiiCommitted d207c7d and pushed to 8.7.x. Also cherry-picked to 8.6.x as this only touched documentation. Thanks!