Score:1

How is a ckeditor plugin form is discovered and loaded for the plugin?

mx flag
awm

I am trying to understand how Text filters settings form are used. For example, if you look at the url_embed module it has:

src/Form/UrlEmbedDialog.php
src/plugin/Filter/UrlEmbedFilter

How does the filter plugin connect to the form? I.e. when you click on a plugin button in the text field (body field of a node) it shows the form with a URL text field to embed. This form is defined independently in src/Form/UrlEmbedDialog.php

apaderno avatar
us flag
The answer *How does the filter plugin connect to the form?* is that the setting form shown for an input filter is simply a form built by Drupal core that calls the `settingsForm()` method defined in the input filter plugin. Anyway, you are using as example a module where a CKEditor plugin, an input filter plugin, a field formatter plugin, a service, a form class, JavaScript, and AJAX are involved. Answering how the `UrlEmbedDialog` form is shown by `UrlEmbedFilter` would require to explain how that module works, which too much to explain for the question asked here.
apaderno avatar
us flag
Furthermore, that module uses classes/traits implemented by the [Embed](https://www.drupal.org/project/embed) module. Starting from the `UrlEmbedFilter` code, it will take time to understand how the `UrlEmbedDialog` is involved.
awm avatar
mx flag
awm
@apaderno That's fair. I am actually trying to understand how a Ckedito plugin and it's form are connected. Do you have examples or any documentation how ckedior plugin form is discovered? Say I want to create a custom ckedior plugin, and when it's clicked I want a custom form to be loaded. Is it naming convention that determine the form or an ajax request?
apaderno avatar
us flag
Generally speaking, CKEditor plugins do not have Drupal forms. The class implementing a CKEditor plugin returns a list of CKEditor buttons in `getButtons()`. The rest is done from the JavaScript code used by the specific CKEditor plugin, which could also show a modal dialog containing a Drupal form, for example. As start, I would suggest [CKEditor 4 API overview](https://www.drupal.org/docs/8/api/ckeditor-api/overview) and [CKEditor module overview](https://www.drupal.org/docs/contributed-modules/ckeditor/ckeditor-module-overview).
apaderno avatar
us flag
Keep also in mind that Drupal 10 uses CKEditor 5 through the [CKEditor 5](https://www.drupal.org/docs/core-modules-and-themes/core-modules/ckeditor-5-module) module. The integration with CKEditor is totally changed with that module (also because CKEditor 5 is totally changed).
apaderno avatar
us flag
As a side note, it would be much helpful if chat were used more from users participating on this site. It would make possible to ask preliminary questions that would help in asking a question on this site.
awm avatar
mx flag
awm
I did not even know there is a chat feature. I do use slack drupal support to begin with. However, asking a question and having comments/answers may serve other users a bit more than chat. That said, I get your point. In fact, you did answer my question in your third comment.
apaderno avatar
us flag
Asking questions to get answers in comments is not how Stack Exchange sites are supposed to work. Then, questions closed as off-topic affect negatively new users who asked them. Anyway, my note about the chat usage was a general note referred to all the users in this site. You cannot ask how to better shape/focus a question on chat because nobody would answer you, as nobody uses the chat room.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.