Thanks for the module, fills in a vital missing piece of the puzzle!

We're trying to bring it into our distribution, LocalGov Drupal, but our automated tests are throwing up missing schema errors.

For example:

Drupal\Core\Config\Schema\SchemaIncompleteException: Schema errors for core.entity_form_display.paragraph.localgov_featured_campaign.default with the following errors: core.entity_form_display.paragraph.localgov_featured_campaign.default:content.localgov_featured_campaign_image.third_party_settings.media_library_edit missing schema

I'll create an issue fork repo and see if I can resolve.

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

I've not had much joy trying to get this to work.

I've tried the approach from:
https://git.drupalcode.org/project/display_machine_name/-/blob/2.x/confi...

Creating a file, config/schema/media_library_edit.yml with

core.entity_form_display.*.*.*.third_party.media_library_edit:
  type: media_library_edit.third_party_settings

media_library_edit.third_party_settings:
  type: mapping
  label: 'Media edit button option'
  mapping:
    media_library_edit:
      type: string
      label: 'Edit link'

I've tried the approach from:
https://git.drupalcode.org/project/field_group/-/blob/8.x-3.x/config/sch...

core.entity_form_display.*.*.*.third_party.media_library_edit:
  - type: sequence
    label: 'Media library edit'
    sequence:
      type: mapping
      label: 'Media edit button'
      mapping:
        media_library_edit:
          type: boolean
          label: 'Edit link'

Still we get failures on any phpunit tests that enable modules with entities that make use of the media_library_edit button.

1) Drupal\Tests\localgov_directories_promo_page\Kernel\RolesIntegrationTest::testEnablingRolesModule
Drupal\Core\Config\Schema\SchemaIncompleteException: Schema errors for core.entity_form_display.paragraph.localgov_image.default with the following errors: core.entity_form_display.paragraph.localgov_image.default:content.localgov_image.third_party_settings.media_library_edit missing schema

See https://github.com/localgovdrupal/localgov_project/actions/runs/33352863...

Any pointers from anyone that understands schema definition for third_party_settings would be most welcome.

ekes made their first commit to this issue’s fork.

ekes’s picture

Status: Active » Needs review

Looking at the code it's clear this is adding a third party setting to a widget
https://git.drupalcode.org/issue/media_library_edit-3315757/-/blob/76b88...
Looking at Drupal's core configuration you can see here https://git.drupalcode.org/project/drupal/-/blob/9.5.x/core/config/schem... that it gives the name field.widget.third_party.[%key] to core.entity_form_display.*.*.*:content.third_party_settings

The third party settings test module gives a good example of this adding the third party setting https://git.drupalcode.org/project/drupal/-/blob/56990e5ff9a7533d47282de... and adding the config https://git.drupalcode.org/project/drupal/-/blob/9.5.x/core/modules/fiel...

So we come out with:

field.widget.third_party.media_library_edit:
  type: mapping
  label: 'Media library edit settings'
  mapping:
    show_edit:
      type: string
      label: 'Show edit button'

it's a string because of the way the configuration is presently actually used. This should be in the issue fork branch.

progga’s picture

Status: Needs review » Reviewed & tested by the community

Tested this config file with the config_inspector module. All looks good. Thanks for the fix :)

ahebrank’s picture

Version: 8.x-2.x-dev » 3.0.x-dev
ahebrank’s picture

I had to rebase the MR to get it on 3.x -- can someone verify I got the correct version?

Finn Lewis’s picture

The merge request looks correct, thanks!

Seem to have lost the commit from ekes though, is that how rebasing works?

Just want to make sure ekes gets the credit, I was scratching my head on this one!

ahebrank’s picture

Yeah, I noticed that too -- not sure why that happened. Let me see if I can rewrite the author on the last commit.

  • ahebrank committed d2a6f5d on 3.0.x
    Issue #3315757: third_party_settings.media_library_edit missing schema...
ahebrank’s picture

Status: Reviewed & tested by the community » Fixed
ahebrank’s picture

Well, I thought I screwed that up but it looks like credit was assigned properly. Thanks to you both!

Finn Lewis’s picture

Thanks ever so much @ahebrank!

I don't suppose you're up for a cheeky 3.0.1 release to follow up on today's 3.0.0 release are you?

ahebrank’s picture

Sure thing.

Status: Fixed » Closed (fixed)

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