Problem/Motivation

We have a plan to adopt two properties from Display Builder project in our source config schema:

We also need them as field properties in our Source field type, alongside the 2 existing properties:

        'source_id' => [
          'type' => 'varchar_ascii',
        ],
        'source' => [
          'type' => 'blob',

Because:

  • Symmetric translations is also expected in content storage
  • third_party_settings will fix a display builder bug. See below:

When we save a display as a field, we put each source from the root as a field item:

    foreach ($data as $offset => $item) {
      $this->list[$offset] = $this->createItem($offset, $item);
    }
    $this->getEntity()->save();

However, we have this in the root:

 0 => array:4 [▼
    "node_id" => "68e6c7e9e3ba0"
    "source_id" => "component"
    "source" => array:1 [▶]
    "_third_party_settings" => array:1 [▶]
  ]
  2 => array:4 [▼
    "node_id" => "68e6d0d3b81d4"
    "source_id" => "component"
    "source" => array:1 [▶]
    "_third_party_settings" => array:1 [▶]

]

So, node_id and _third_party_settings are not saved.

Proposed resolution

Add those 2 properties to the field storage. Which typed data type?

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:

Comments

pdureau created an issue. See original summary.

pdureau’s picture

Issue summary: View changes
pdureau’s picture

Issue summary: View changes
Issue tags: +display_builder-1.0.0-beta

christian.wiedemann made their first commit to this issue’s fork.

christian.wiedemann’s picture

Assigned: christian.wiedemann » pdureau
Status: Active » Needs review
christian.wiedemann’s picture

I added the two new columns and also ensure that our form elements pass repass this back to the field.

pdureau’s picture

Assigned: pdureau » christian.wiedemann
Status: Needs review » Needs work

Hello,

I am testing with an existing content display override in Display Builder.

The updb has run successfully:

 $ ddev drush updb
  ui_patterns_field   10001       hook_update_n   10001 - Add additional columns. Add third_party_settings and node_id to ui_patterns_source fields.  

However, when I click on "Publish" button in the content display override in Display Builder, I get this:

Drupal\Core\Entity\EntityStorageException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'field_teaser_third_party_settings' in 'INSERT INTO': INSERT INTO "node__field_teaser" ("entity_id", "revision_id", "bundle", "delta", "langcode", "field_teaser_source_id", "field_teaser_source", "field_teaser_third_party_settings", "field_teaser_node_id") VALUES (...) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 815 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
pdureau’s picture

Assigned: christian.wiedemann » pdureau
Status: Needs work » Needs review
pdureau’s picture

Assigned: pdureau » christian.wiedemann
Status: Needs review » Reviewed & tested by the community

OK for me. Thanks a lot.

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

grimreaper’s picture

Status: Reviewed & tested by the community » Needs work

Hi,

One minor changes to do in the hook_update number.

Thanks for your work here!

just_like_good_vibes’s picture

Assigned: christian.wiedemann » Unassigned
Status: Needs work » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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

herved’s picture

This is producing a lot of config schema errors on my side:

$ ddev drush config:inspect --only-error --detail --list-constraints
➜  🤖 Analyzing…

 Legend for Data: 
  ✅❓  → Correct primitive type, detailed validation impossible.
  ✅✅  → Correct primitive type, passed all validation constraints.
 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------- ------------- ------ 
  Key                                                                                                                                                                                                                                            Status           Validatable   Data  
 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------- ------------- ------ 
  core.entity_view_display.public_health_event.public_health_event.default:third_party_settings.layout_builder.sections.0.components.c9e4ddb9-10e5-490d-a445-45744751095c.configuration.ui_patterns.slots.value.sources.0.node_id                missing schema                       
  core.entity_view_display.public_health_event.public_health_event.default:third_party_settings.layout_builder.sections.0.components.c9e4ddb9-10e5-490d-a445-45744751095c.configuration.ui_patterns.slots.value.sources.0.third_party_settings   missing schema                       
  core.entity_view_display.public_health_event.public_health_event.default:third_party_settings.layout_builder.sections.0.components.c9e4ddb9-10e5-490d-a445-45744751095c.configuration.ui_patterns.third_party_settings                         missing schema                       
  core.entity_view_display.public_health_event.public_health_event.default:third_party_settings.layout_builder.sections.0.components.c9e4ddb9-10e5-490d-a445-45744751095c.configuration.ui_patterns.node_id                                      missing schema                       
 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------- ------------- ------ 

Also node_id looks specific to nodes, what I have here are custom entities (public_health_event).

Edit: Ah ok this was already reported in #3574820: Unexpected properties in ComponentSource data