Hi there!

The following commit from #2860044: Make Comment line translatable via Field setting changes the schema for comment settings on the office_hours field.

https://git.drupalcode.org/project/office_hours/-/commit/f8ccbca04054791...

We use this field in a paragraph type on the localgov_paragraphs project in the LocalGov Drupal distribution.

Our automated tests started failing due to this change, so I have updated the default configuration to address this:
https://github.com/localgovdrupal/localgov_paragraphs/pull/33/files

However, we also test an update from an older installation database dump to confirm that upgrades will work.

In this update test case our tests are now failing with something like this error:

Schema key field.storage.paragraph.localgov_contact_office_hours:settings.comment failed with: variable type is boolean but applied schema class is Drupal\Core\TypedData\Plugin\DataType\IntegerData

I am wondering if we need to write an update hook specifically to help update live configuration that uses this schema, along the lines of example 2 on this page:

https://www.drupal.org/docs/drupal-apis/update-api/updating-configuratio...

Before we look at that, I thought I would post here in case the maintainers have any better advice!

Many thanks,

Finn

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Finn Lewis created an issue. See original summary.

Finn Lewis’s picture

Issue summary: View changes
Finn Lewis’s picture

Issue summary: View changes

johnv’s picture

Status: Active » Needs review

The case is The the field changed from 2 to 3 options:
false / 0= no workflow comment enabled
true / 1= workflow comment enabled
n/a / 2= translatable workflow comment enabled

The third option is added, since adding the feature to (true/1) may have drawbacks on existing installations.
But the contrary occurs.

I guess your update_hook is to way to go.

Should I commit it?

Finn Lewis’s picture

Hi @johnv

This change works for us and fixes the failing tests.

I made a small change to the config save, moving it up within the previous if statement, so that it only saves if we've made a change.

If you can commit and do a release, that would be great!

Many thanks,

Finn

johnv’s picture

Title: Schema key field.storage.paragraph.localgov_contact_office_hours:settings.comment failed with: variable type is boolean but applied schema class is Drupal\Core\TypedData\Plugin\DataType\IntegerData » Add hook_install for translateable office_hours:settings.comment from boolean to integer

  • johnv committed 968146f on 8.x-1.x
    Issue #3218789 by Finn Lewis: Add hook_install for translateable...
johnv’s picture

johnv’s picture

Version: 8.x-1.x-dev » 8.x-1.4
Status: Needs review » Fixed

Thanks, I will release again soon.

Status: Fixed » Closed (fixed)

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