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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

vijaycs85’s picture

Issuing initial patch with config inspector screenshots.

amateescu’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me.

amateescu’s picture

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.

piyuesh23’s picture

Removed widget definitions from schema. Attaching the fixed patch.

piyuesh23’s picture

Status: Needs work » Needs review
piyuesh23’s picture

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

piyuesh23’s picture

Status: Needs review » Reviewed & tested by the community
vijaycs85’s picture

Status: Reviewed & tested by the community » Needs review

@piyuesh23 lets get one more review before RTBC :)

aspilicious’s picture

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

user register form key is obsolete now

swentel’s picture

Status: Needs work » Needs review
FileSize
1.44 KB
644 bytes
amateescu’s picture

+++ 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'?

vijaycs85’s picture

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

vijaycs85’s picture

Status: Needs review » Needs work
vijaycs85’s picture

Status: Needs work » Needs review
FileSize
2.59 KB
2.37 KB

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

vijaycs85’s picture

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.

amateescu’s picture

  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

vijaycs85’s picture

@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...

amateescu’s picture

Status: Needs review » Reviewed & tested by the community

Ok then, this looks ready to me.

webchick’s picture

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.