Follow up for #1953404: Add config schema to field and instance config entities

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. As a part of schema addition to field module(#1953404: Add config schema to field and instance config entities), found that we have to provide schema for field types, field widgets and field storage.

Proposed solution

Create a configuration schema for field types, field widget and field storage (if applicable) defined in entity_reference module.
Schema in place

Schema not in place
field.entity_reference.settings
field.entity_reference.instance_settings
field.entity_reference.value

field_widget.entity_reference_autocomplete.settings
field_widget.entity_reference_autocomplete_tags.settings

Files: 
CommentFileSizeAuthor
#17 1983902-config-schema-entity_reference-17.patch2.79 KBvijaycs85
PASSED: [[SimpleTest]]: [MySQL] 59,423 pass(es).
[ View ]
#17 1983902-diff-15-17.txt1.4 KBvijaycs85
#15 1983902-config-schema-entity_reference-15.patch2.79 KBvijaycs85
PASSED: [[SimpleTest]]: [MySQL] 59,454 pass(es).
[ View ]
#15 1983902-diff-14-15.txt1.08 KBvijaycs85
#14 1983902-config-schema-entity_reference-14.patch2.37 KBvijaycs85
PASSED: [[SimpleTest]]: [MySQL] 59,379 pass(es).
[ View ]
#14 1983902-diff-10-14.txt2.59 KBvijaycs85
#10 interdiff.txt644 bytesswentel
#10 1983902-field-config-schema-entity-reference-10.patch1.44 KBswentel
PASSED: [[SimpleTest]]: [MySQL] 59,406 pass(es).
[ View ]
#4 1983902-field-config-schema-entity-reference-4.patch1.53 KBpiyuesh23
PASSED: [[SimpleTest]]: [MySQL] 56,384 pass(es).
[ View ]
#1 field.field_.entity_reference.png35.98 KBvijaycs85
#1 field.instance.entity_reference.png51.19 KBvijaycs85
#1 1983902-field-config-schema-entity-reference-1.patch2.3 KBvijaycs85
PASSED: [[SimpleTest]]: [MySQL] 55,563 pass(es).
[ View ]

Comments

Status:Active» Needs review
StatusFileSize
new2.3 KB
PASSED: [[SimpleTest]]: [MySQL] 55,563 pass(es).
[ View ]
new51.19 KB
new35.98 KB

Issuing initial patch with config inspector screenshots.

Status:Needs review» Reviewed & tested by the community

Looks good to me.

Status:Reviewed & tested by the community» Needs work

Actually, that's not right. Widget definitions have been moved out of the instance definition in #1875992: Add EntityFormDisplay objects for entity forms.

StatusFileSize
new1.53 KB
PASSED: [[SimpleTest]]: [MySQL] 56,384 pass(es).
[ View ]

Removed widget definitions from schema. Attaching the fixed patch.

Status:Needs work» Needs review

Tested and the schema is working fine. Tested using config inspector.

Status:Needs review» Reviewed & tested by the community

Status:Reviewed & tested by the community» Needs review

@piyuesh23 lets get one more review before RTBC :)

Issue summary:View changes
Status:Needs review» Needs work

user register form key is obsolete now

Status:Needs work» Needs review
StatusFileSize
new1.44 KB
PASSED: [[SimpleTest]]: [MySQL] 59,406 pass(es).
[ View ]
new644 bytes

+++ b/core/modules/entity_reference/config/schema/entity_reference.schema.yml
@@ -0,0 +1,48 @@
+field.entity_reference.value:
...
+          label: 'Value'

Shouldn't this be 'field.entity_reference.target_id' and 'Target ID'?

Assigned:Unassigned» vijaycs85

We got more than just field implementation as part of this issue. Check https://gist.github.com/vijaycs85/7917782 for more details...

Status:Needs review» Needs work

Status:Needs work» Needs review
StatusFileSize
new2.59 KB
new2.37 KB
PASSED: [[SimpleTest]]: [MySQL] 59,379 pass(es).
[ View ]

Updating with views & default entity_reference plugins... remaining to follow...

Assigned:vijaycs85» Unassigned
StatusFileSize
new1.08 KB
new2.79 KB
PASSED: [[SimpleTest]]: [MySQL] 59,454 pass(es).
[ View ]

Ok, just did a full scan of entity_reference in our code base and here are the findings:

  1. We got just two groups: default and views.
  2. Except views all other entity reference fall under default
  3. There are three type of entity_references under default
    1. No fields in reference type
    2. Using existing(target_bundles & sort) fields in reference type
    3. Adding new fields to reference type (just two: User[filter] & Taxonomy[auto_create])

The patch in #14 covers all listed above except 3.3. Here is the patch for it.

  1. +++ b/core/modules/entity_reference/config/schema/entity_reference.schema.yml
    @@ -0,0 +1,68 @@
    +      label: 'Create referenced entities if they don''t already exist'

    Is '' allowed/the correct syntax? Couldn't we just wrap the whole string in "" ?

  2. +++ b/core/modules/entity_reference/config/schema/entity_reference.schema.yml
    @@ -0,0 +1,68 @@
    +    filter:
    ...
    +    target_bundles:
    ...
    +    sort:
    ...
    +    auto_create:

    I think the correct order (by how they are defined/importance) would be:
    - target_bundles
    - sort
    - filter
    - auto_create

StatusFileSize
new1.4 KB
new2.79 KB
PASSED: [[SimpleTest]]: [MySQL] 59,423 pass(es).
[ View ]

@amateescu, thanks for the quick response...

Reg:
#16.1 - Yes, single quotes is the escape character in yml and we have done in lots of places (Can check with reg search [a-zA-Z]+''[a-zA-Z]+)

#16.2 - Order of the fields really not fixed. sometimes it gets changed whenever we save config (view config is a good example.), but I just updated it as we want them in this order...

Status:Needs review» Reviewed & tested by the community

Ok then, this looks ready to me.

Status:Reviewed & tested by the community» Fixed

Committed and pushed to 8.x. Thanks!

Status:Fixed» Closed (fixed)

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