This is a sub-issue of #1910624: [META] Introduce and complete configuration schemas in all of core.

Problem/motivation

#1866610: Introduce Kwalify-inspired schema format for configuration introduced the idea of config schema. The changelog leads to (hopefully extensive) documentation on the format at http://drupal.org/node/1905070. While there are little cleanups planned for the format overall, the current format is a result of months of back and forths, so it should be perfectly fine to apply it more widely to core.

Proposed solution

Create a configuration schema for editor module.

Schema in place

Schema not yet in place
editor.editor.*.yml

Sample (interesting) config file:

format: basic_html
editor: ckeditor
settings:
  toolbar:
    buttons:
      -
        - Bold
        - Italic
        - '|'
        - Link
        - Unlink
        - '|'
        - BulletedList
        - NumberedList
        - '|'
        - Blockquote
        - Image
        - '|'
        - Source
  plugins:
    stylescombo:
      styles: ''
status: '1'
langcode: und
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

vijaycs85’s picture

Issue summary: View changes

Updating sample config.

vijaycs85’s picture

Status: Active » Needs review
FileSize
42.28 KB
1.34 KB

Adding schema with config_inspector screenshots...

Wim Leers’s picture

Status: Needs review » Needs work

Editor module only controls the top-level keys: format, editor, settings, status and langcode.

Anything inside "settings" is Text Editor Plugin-specific. It'll be interesting to see whether it's even possible to express that :)

Gábor Hojtsy’s picture

Wim: it is definitely possible to do that :) So those would be with ckeditor module then? Dynamic types are supported in schemas, views, image styles, etc. use this :)

Wim Leers’s picture

Yes, currently CKEditor is the only Text Editor Plugin. There's also UnicornEditor, but that's just a module for testing purposes.

And: cool :)

vijaycs85’s picture

Status: Needs work » Needs review
FileSize
1.72 KB

Updated schema get settings from CKeditor and CKeditor get plugin. Can see StylesCombo and Internal, but not sure how to use Internal to add its schema.

Gábor Hojtsy’s picture

Status: Needs review » Needs work

Noticed this on a quick review:

+++ b/core/modules/editor/config/schema/editor.schema.ymlundefined
@@ -0,0 +1,20 @@
+editor.editor.*:
+  type: mapping
+  label: 'Contact category'

Contact category is definitely not true :)

I did not cross-check with the data .yml, so cannot vouch for correctness of that.

Wim Leers’s picture

+++ b/core/modules/ckeditor/config/schema/ckeditor.schema.ymlundefined
@@ -0,0 +1,33 @@
+  label: 'Settings'

Maybe "CKEditor settings" instead?

+++ b/core/modules/ckeditor/config/schema/ckeditor.schema.ymlundefined
@@ -0,0 +1,33 @@
+          label: 'Active toolbar'

I think this should be "Rows".

The "buttons" key contains a sequence of rows, with each row containing a sequence of buttons, with each button being a string.

+++ b/core/modules/ckeditor/config/schema/ckeditor.schema.ymlundefined
@@ -0,0 +1,33 @@
+  label: 'Styles combo'

s/Styles combo/Styles dropdown/

(Assuming that we should be using UI labels.)

OR

s/Styles combo/stylescombo/

(Assuming that we should be using plugin names/identifiers.)

+++ b/core/modules/ckeditor/config/schema/ckeditor.schema.ymlundefined
@@ -0,0 +1,33 @@
+      label: 'Style'

s/Style/List of styles/

(I know this seems counterintuitive, but classes are stored in a h1.title|Title\np.callout|Callout\n form.)

+++ b/core/modules/editor/config/schema/editor.schema.ymlundefined
@@ -0,0 +1,20 @@
+  label: 'Contact category'

"Text Editor" :)

(Or should it be plural? That's what filter.schema.yml has.)

+++ b/core/modules/editor/config/schema/editor.schema.ymlundefined
@@ -0,0 +1,20 @@
+      label: 'Default language'

I think this should be just "Language", not "Default language"?

The language is *not* configurable through the UI, this is the language set by the Config Entity subsystem.

I looked at other *.schema.yml files, and the labels for this vary: "Langcode", "Language", "Default language". We should standardize on one.

vijaycs85’s picture

Status: Needs work » Needs review
FileSize
1.52 KB
1.72 KB

Thanks @Gábor Hojtsy and @Wim Leers for the review. Fixed labels and here is few comment.

1. s/Styles combo/Styles dropdown/ - We want to keep schema labels consistent with the UI. If there is no UI, we take our call. However found 'Styles dropdown' in config entity defition. So using it.

2. (Or should it be plural? That's what filter.schema.yml has.) - May be we need to fix filter :) as this is representing single filter and single editor this case.

3. I looked at other *.schema.yml files, and the labels for this vary: "Langcode", "Language", "Default language". We should standardize on one. - Agreed. We can stick with 'Language' where we can't be changed and 'Default language' where we can. This can be done in all schema once moved all in. #1971490: Standardize label of langcode field in schema files.

Gábor Hojtsy’s picture

I think its fine as "Default language" or "Language", contrib might provide a UI to change language even for config entities/files where it is not possible to change by default.

Wim Leers’s picture

Status: Needs review » Reviewed & tested by the community

Awesome, thank you!

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 24f5462 and pushed to 8.x. Thanks!

Gábor Hojtsy’s picture

Thanks all!

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Updated issue summary.