Following #3562686: Entity view override enhancements.

Error when creating an override for an non default display

I can setup an override for the default display of a node, but not for another one (like "teaser" or "search_index").
On form submit:

Error: Call to a member function get() on null in Drupal\display_builder_entity_view\Form\LayoutBuilderEntityViewDisplayForm->createOverrideField() (line 359 of modules/custom/display_builder/modules/display_builder_entity_view/src/Form/EntityViewDisplayFormTrait.php).

Drupal\display_builder_entity_view\Form\LayoutBuilderEntityViewDisplayForm->submitForm() (Line: 108)

UX issues

Without any UI Patterns field in the bundle:

  • ✅ No field selection, automatic field creation (but maybe making the field creation more explicit would help the user),
  • ❌ However, the field is called field_display_builder instead of something related to the display, is it the cause of the error?

With only "already taken" UI Patterns fields in the bundle:

  • Not tested yet because of " Call to a member function get() on null" error

With already at least one UI Patterns field in the bundle:

  • ✅ I can select the field
  • ✅ I can also select a field previously taken then released
  • ❌ But automatic creation is not available anymore.

Once a field is selected:

  • ❌ it is locked, not possible to delete, change cardinality or set a default value. The same issue we have with Layout Builder today.
  • ❌ releasing the field (by unselecting it from the display) is not helping, still locked

After deletion of a selected field:

  • Not tested yet because locked field
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

Title: Wrong field management in Entity view override » Field management in Entity view override
pdureau’s picture

Assigned: Unassigned » mogtofu33

Hi Jean, assigned ot you because it is a follow-up of a ticket of yours.

mogtofu33’s picture

Status: Active » Needs work

Will check, so you know for the lock part, we cannot unlock a locked field, must be deleted from config.
We can adapt the name but the field storage is the same, the field config only change for the same entity, do we want a different storage name?

mogtofu33’s picture

Assigned: mogtofu33 » pdureau
Status: Needs work » Needs review

PHP error fixed. Lock and unlocked fixed.
We have a name limitation, so replaced default name to a simple filed_NODETYPE_BUNDLE_VIEWMODE.

We still have non covered cases when deleting / changing the field, but they are hard to address simply. Will be a follow up case by case if required, better to start simple with something that match the need with less confusion for regular users.

pdureau’s picture

Status: Needs review » Reviewed & tested by the community

Without any UI Patterns field in the bundle or without any UI Patterns field in the bundle:

  • ✅ No field selection, automatic field creation and after that a select list
  • ⚠️ filed_NODETYPE_BUNDLE_VIEWMODE may not be the right naming. filed_display_VIEWMODE may be better because:
    • it is enough because fields are already "namespaced" by entity & bundle
    • it will be less at risk to meet the 32 characters limit for field names
    • it will allow all overrides of different bundle to share the SQL table instead of creating many tables

With at least one UI Patterns field available in the bundle:

  • ✅ I can select the field
  • ✅ I can also select a field automatically created then deselected
  • ⚠️ But automatic creation is not available. This is not a big deal, i can create a follow-up ticket for a late beta
  • ❌ Fields for other bundles are also available because we list field storages instead of field instances

Once a field is selected:

  • ✅ They are locked only when in use, I am still doubting about this locking mechanism, but I like this compromise

I will propose a commit with the new field name, a bit of wording, and maybe a fix.

pdureau’s picture

Assigned: pdureau » mogtofu33
Status: Reviewed & tested by the community » Needs review
mogtofu33’s picture

Assigned: mogtofu33 » pdureau
Status: Needs review » Needs work
pdureau’s picture

Assigned: pdureau » mogtofu33
Status: Needs work » Needs review

  • mogtofu33 committed f0c27e29 on 1.0.x authored by pdureau
    fix: #3577332 Field management in Entity view override
    
    By: pdureau
    By:...
mogtofu33’s picture

Assigned: mogtofu33 » Unassigned
Status: Needs review » 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.