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 toolbar module.

Schema in place

Schema not yet in place
toolbar.breakpoints.yml
toolbar.config.yml

Files: 
CommentFileSizeAuthor
#12 toolbar_schema.png653.09 KBYesCT
#12 toolbar_configure.png166.28 KBYesCT
#8 Selection_045.png20.32 KBdsnopek
#8 Selection_046.png16.46 KBdsnopek
#8 1919212-toolbar-schema-8.patch768 bytesdsnopek
PASSED: [[SimpleTest]]: [MySQL] 52,445 pass(es). View
#3 toolbar_scema.PNG57.57 KBrahuldolas123
#2 1919212-toolbar-schema-2.patch725 bytesvyasamit2007
PASSED: [[SimpleTest]]: [MySQL] 52,217 pass(es). View
#1 1919212-toolbar-schema-1.patch588 bytesvijaycs85
PASSED: [[SimpleTest]]: [MySQL] 50,765 pass(es). View

Comments

vijaycs85’s picture

Status: Active » Needs review
FileSize
588 bytes
PASSED: [[SimpleTest]]: [MySQL] 50,765 pass(es). View

Adding schema file...

vyasamit2007’s picture

FileSize
725 bytes
PASSED: [[SimpleTest]]: [MySQL] 52,217 pass(es). View

Schema file with new changes and as per the updated schema documentation http://drupal.org/node/1905070#codestyle

rahuldolas123’s picture

Status: Needs work » Needs review
FileSize
57.57 KB

Hi,

I tested the patch with config inspector module and I can only see the forms for 'toolbar.breakpoints.yml' file.
The form for 'toolbar.config.yml' file is not shown. The file toolbar.config.yml should be renamed to 'toolbar.settings.yml' so that both the settings can be visible.

screenshots:
toolbar patch

toolbar.settings not shown:
Only local images are allowed.

rahuldolas123’s picture

Status: Needs review » Needs work
vijaycs85’s picture

Status: Needs review » Postponed

Thanks @rahuldolas123. I have raised an issue #1925380: Rename toolbar.config.yml to toolbar.settings.yml to see if it has some reason to name it that way. For now, we leave schema file as it is. We will change, if it config file has to be toobar.config.yml.

postpone-ding until #1925380: Rename toolbar.config.yml to toolbar.settings.yml get fixed...

aspilicious’s picture

Status: Postponed » Active
vijaycs85’s picture

Status: Active » Needs review

Patch in #2 is ready for review now

dsnopek’s picture

FileSize
768 bytes
PASSED: [[SimpleTest]]: [MySQL] 52,445 pass(es). View
16.46 KB
20.32 KB

Looking at the form for toolbar.settings in the config_inspector throws an error:

Notice: Array to string conversion in Drupal\Core\TypedData\TypedData->getString() (line 69 of core/lib/Drupal/Core/TypedData/TypedData.php).

+++ b/core/modules/toolbar/config/schema/toolbar.schema.yml
+    breakpoints:
+      type: string
+      label: 'Breakpoints'

This should really be 'sequence' not 'string'. Attached is a new patch that fixes this!

However, no matter what I set for label it's always 'String' for the individual items of the sequence. Is it not possible to set labels on individual items of a sequence? Or is this a bug in the config_inspector?

sandipmkhairnar’s picture

I have reviewed and apply the patch . Its working fine for me.

tim-e’s picture

Status: Needs review » Reviewed & tested by the community

Looking good to me

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed to 8.x. Thanks!

YesCT’s picture

Status: Fixed » Reviewed & tested by the community
FileSize
166.28 KB
653.09 KB

config_inspector was updated, had to get the latest.

+++ b/core/modules/toolbar/config/schema/toolbar.schema.ymlundefined
@@ -0,0 +1,25 @@
+      sequence:
+        - type: string
+

the items in the sequence dont have a Label, so that is why they are all string.

toolbar_schema.png

I agree, no errors and everything looks good.

so still rtbc.

question: is there any form in the ui for the toolbar breakpoint settings? (toolbar.breakpoints.yml)
The toolbar configure link does not actually go anywhere.

toolbar_configure.png

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Hm. I think that might've been a cross-post?

dsnopek’s picture

@YesCT: I tried adding a label but it had no effect so, I didn't include it in the patch. Also, I'm not sure what the label should be! Should every item in the sequence have the label "Breakpoint"? Really, they should probably be labeled: 1, 2, 3, ... etc.

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