Problem/Motivation

config schema errors.

Steps to reproduce

create a custom ViewsReference Setting
config schema erorrs are visable in field.field.paragraph.view.field_view_reference when viewing Configuration inspector

Proposed resolution

replace

enabled_settings:
      type: sequence
      label: 'Enabled settings'
      sequence:
      type: viewsreference.enabled_settings.[%key]

with:

    enabled_settings:
      type: sequence
      label: 'Enabled settings'
      sequence:
        type: integer

Comments

perry.franken created an issue. See original summary.

perry.franken’s picture

A created a path for this issue.

perry.franken’s picture

Issue summary: View changes
StatusFileSize
new160.88 KB
perry.franken’s picture

changed it to string:

hudri’s picture

For people looking for a fix to the "display title option" or "only pagination and argument shown" problem, this patch here makes that option work again.

I think the approach here is correct. The configuration values of enabled_settings are always strings, even if the actual per-field setting values stored in the DB are of other types.

hudri’s picture

Status: Active » Reviewed & tested by the community
hudri’s picture

Title: configuration schema for Views reference field settings gives errors » Configuration schema for "Enable extra settings" (title,pagination,...) incorrect
redeight’s picture

As hudri said, the patch fixes an issue we're having with using these options on our sites.

ricovandevin’s picture

I can confirm that before applying the patch from #4 the options 'limit', 'offset' and 'title' could not be enabled (their values in the config were set to 0) and after applying this patch they can be enabled (again).

sseto’s picture

Confirm #4 fixes my issue too!

paulrad’s picture

Hi, guys!
Shouldn't there be some update function to make those changes applicable to the current users?

hudri’s picture

Due this bug it is not possible to activate those options, so I don't think an update hook could reliably fix this.

daletrexel’s picture

Add one more RBTC for me: patch #4 is simple but does the trick.

You do have to go back and re-set views reference fields that were changed by this issue (created or edited after upgrade to beta 7), and that's likely going to be a case-by-case process, so it doesn't seem suitable for an update hook.

generalredneck’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new1.1 KB

Ass the patch stands, it leaves cruft in the configuration schema. The way the schema was developed, they were adding a separate entry for each plugin. Obviously that's no longer correct, so lets do the type string sequence AND remove the definitions for the individual settings.

daletrexel’s picture

Status: Needs review » Reviewed & tested by the community

Patch #14 doesn't change the config output in my case (no cruft for us) but it continues to work for me. Changing back to RBTC.

generalredneck’s picture

For reference, the schema doesn't control what's exported in config management explicitly, it just tells config management what to expect in the config.yml files. In this case, since the last patch did this:

       type: sequence
       label: 'Enabled settings'
       sequence:
-        type: viewsreference.enabled_settings.[%key]
+        type: string

That means that viewsreference.enabled_settings.[%key] is no longer used, therefore the entries in the schema that were created for this are no longer needed, therefore my addition of

@@ -54,26 +54,6 @@ field.value.viewsreference:
       type: string
       label: 'Serialized data'
 
-viewsreference.enabled_settings.argument:
-  type: string
-  label: 'Argument settings'
-
-viewsreference.enabled_settings.limit:
-  type: integer
-  label: 'Limit results settings'
-
-viewsreference.enabled_settings.offset:
-  type: integer
-  label: 'Offset results settings'
-
-viewsreference.enabled_settings.pager:
-  type: string
-  label: 'Pagination settings'
-
-viewsreference.enabled_settings.title:
-  type: boolean
-  label: 'Include View Title settings'
-
 viewsreference.plugin_types:
   type: sequence
   label: 'View display plugins to allow'

to the patch. It's simply to clean up pieces in the configuration schema that are now unused.

daletrexel’s picture

Thanks, @generalredneck! I wasn't 100% certain whether or not your removal of those entries would have impacts to users' configurations too, whether exported before or after the update that broke things.

Also, it gave me the chance to confirm that the updated patch had been reviewed and tested good enough for my purposes!

daisyleroy’s picture

patch #14 fixes my issue thanks !

liberatr’s picture

For me, this patch was not working until I manually edited my config file and reimported. Example below:

field.field.paragraph.events.field_event_list.yml:
(For your own field, you will have to find the "field.field.[entity].field_name" that's relevant to you)
(this is just the last 15 or so lines of the file)

...
settings:
  handler: 'default:view'
  handler_settings:
    target_bundles: null
    auto_create: false
  plugin_types:
    block: block
  preselect_views: {  }
  enabled_settings:
    limit: limit
    offset: offset
    title: title
    pager: pager
    argument: argument
field_type: viewsreference

...where the old incorrect values were:

  enabled_settings:
    limit: 1
    offset: 1
    title: true
    pager: pager
    argument: argument

  • ea1ea74c committed on 8.x-2.x
    Issue #3402036 by perry.franken, generalredneck, hudri, DaleTrexel,...
seanb’s picture

Status: Reviewed & tested by the community » Fixed

Thanks all! Committed the latest patch.

sseto’s picture

Should I use the dev version to get the update or will there Beta8 release soon? Thanks everyone!

it-cru’s picture

+1 for a new beta release :)

generalredneck’s picture

So we need to reiterate in the release notes that there are manual steps to remediation.

Comments #11-13 and #19 are all talking about it.

As said in #13, an upgrade hook is impossible because the configuration has been polluted/changed by the last release so there is no feasible way to identify who had what checked prior.

Reconfiguration of the module is the only valid step forward.

grevil’s picture

I don't quite understand, why an update hook is not feasible here?

Before, an entry of "enabled_settings" could either be a string, a boolean or an integer. Meaning we could simply do an empty check on each "enabled_settings" entry and if it is empty, we unset it (just like fieldSettingsFormValidate() does it through the UI) and if it isn't, we simply replace the value with its key, done.

I'll prepare a follow-up issue for that.

PS: If you are talking about the config "pollution" through #2925609: Update viewsreference_update_8103 fails if table name is too long and shortened by Drupal, that could be fixed in the same issue and everyone is happy! :)

grevil’s picture

grevil’s picture

Alright, done.

Everyone in need of an update hook for this, please test and checkout the patch here from #3445081: Add missing update hook for adjusting viewsreference field settings!

generalredneck’s picture

Grevil,

I see where you are coming from. Most of us who have experianced this tried to use the configuration form after the bug. This essentially wiped the configuration.

Obviously I hadn't thought of those who still have configuration intact... say upgrading form beta6 to -dev

Status: Fixed » Closed (fixed)

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