Add a filter for not existed fields to ensure config coherence with the current bundle existing fields

Created on 20 July 2023, over 1 year ago
Updated 10 September 2023, over 1 year ago

Problem/Motivation

Content types may have or not have the following list of fields yet

dependencies:
  config:
    - field.field.node.CONTENT_TYPE_NAME.body
    - field.field.node.CONTENT_TYPE_NAME.field_image
    - field.field.node.CONTENT_TYPE_NAME.field_video
    - field.field.node.CONTENT_TYPE_NAME.field_media
    - node.type.CONTENT_TYPE_NAME

Site Builders keeps changing the list of fields up to the point of deployment of the site to the production site:

  • 'body' : The body field for content types ( A site builder could choose to remove this field on creation or in some point of site building )
  • 'field_image' : Entity referenced to media entity types, but only selected to use images
  • 'field_video' : entity referenced to media entity types, but only selected to use local or remote videos
  • 'field_media' : entity referenced to media entity types, but only selected to use mixed media types ( or all of them )

The VMI module should follow with all status of changes for supported list of fields.

Filter configs for existing fields with the default supported fields

Having inconsistent configurations, which prevent activation of entity display Modes.
Which adding a mismatched configurations that hinder the activation of entity display modes for content types.

The issue arises when required fields are not yet created for the content type, preventing configuration until they are present.

Proposed resolution

Add a filter function to filter configs for existing fields with the default supported fields
This change introduces a filter that checks for the presence of a configuration for the field in the existing media entity.
improve the overall content management system's efficiency and usability.

The filter ensures that the configuration aligns with the current bundle name, preventing any potential confusion or conflicts when dealing with referenced entities.

This enhancement aims to maintain consistency and coherence in the handling of media entity fields throughout the activation of pre-set entity view display on a content type.

Remaining tasks

  • ✅ File an issue about this project
  • ✅ Addition/Change/Update/Fix to this project
  • ✅ Testing to ensure no regression
  • ➖ Automated unit/functional testing coverage
  • ➖ Developer Documentation support on feature change/addition
  • ➖ User Guide Documentation support on feature change/addition
  • ✅ Accessibility and Readability
  • ✅ Code review from 1 Varbase core team member
  • ✅ Full testing and approval
  • ✅ Credit contributors
  • ✅ Review with the product owner
  • ✅ Update Release Notes and Update Helper on new feature change/addition
  • ✅ Release varbase-9.0.15 , vmi-8.x-2.14 , vmi-8.x-2.15 , Varbase 10.0.0-beta1
    , vmi-3.0.0-alpha5 , vmi-3.0.0-alpha6

Varbase update type

  • ✅ No Update
  • ➖ Optional Update
  • ➖ Forced Update
  • ➖ Forced Update if Unchanged

User interface changes

  • N/A

API changes

  • N/A

Data model changes

  • N/A

Release notes snippet

  • Issue #3375779 : Added a filter for not existed fields to ensure config coherence with the current bundle existing fields
📌 Task
Status

Fixed

Version

3.0

Component

Code

Created by

🇯🇴Jordan Rajab Natshah Jordan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Rajab Natshah
  • Issue was unassigned.
  • Status changed to Fixed over 1 year ago
  • 🇯🇴Jordan Rajab Natshah Jordan

    Fixed warning on

    Error message
    Close
    Warning: Undefined array key "media" in Drupal\vmi\ViewModesInventoryFactory->filterConfigsForExistingFields() (line 173 of modules/contrib/vmi/src/ViewModesInventoryFactory.php).
    Warning: foreach() argument must be of type array|object, null given in Drupal\vmi\ViewModesInventoryFactory->filterConfigsForExistingFields() (line 173 of modules/contrib/vmi/src/ViewModesInventoryFactory.php).
    Warning: Undefined array key "media" in Drupal\vmi\ViewModesInventoryFactory->filterConfigsForExistingFields() (line 173 of modules/contrib/vmi/src/ViewModesInventoryFactory.php).
    Warning: foreach() argument must be of type array|object, null given in Drupal\vmi\ViewModesInventoryFactory->filterConfigsForExistingFields() (line 173 of modules/contrib/vmi/src/ViewModesInventoryFactory.php).
    
    
    Warning: Undefined array key "media" in Drupal\vmi\ViewModesInventoryFactory->filterConfigsForExistingFields() (line 173 of modules/contrib/vmi/src/ViewModesInventoryFactory.php).
    Warning: foreach() argument must be of type array|object, null given in Drupal\vmi\ViewModesInventoryFactory->filterConfigsForExistingFields() (line 173 of modules/contrib/vmi/src/ViewModesInventoryFactory.php).
    Warning: Undefined array key "media" in Drupal\vmi\ViewModesInventoryFactory->filterConfigsForExistingFields() (line 173 of modules/contrib/vmi/src/ViewModesInventoryFactory.php).
    Warning: foreach() argument must be of type array|object, null given in Drupal\vmi\ViewModesInventoryFactory->filterConfigsForExistingFields() (line 173 of modules/contrib/vmi/src/ViewModesInventoryFactory.php).
    Warning: Undefined array key "media" in Drupal\vmi\ViewModesInventoryFactory->filterConfigsForExistingFields() (line 173 of modules/contrib/vmi/src/ViewModesInventoryFactory.php).
    Warning: foreach() argument must be of type array|object, null given in Drupal\vmi\ViewModesInventoryFactory->filterConfigsForExistingFields() (line 173 of modules/contrib/vmi/src/ViewModesInventoryFactory.php).
    Warning: Undefined array key "media" in Drupal\vmi\ViewModesInventoryFactory->filterConfigsForExistingFields() (line 173 of modules/contrib/vmi/src/ViewModesInventoryFactory.php).
    Warning: foreach() argument must be of type array|object, null given in Drupal\vmi\ViewModesInventoryFactory->filterConfigsForExistingFields() (line 173 of modules/contrib/vmi/src/ViewModesInventoryFactory.php).
    Warning: Undefined array key "media" in Drupal\vmi\ViewModesInventoryFactory->filterConfigsForExistingFields() (line 173 of modules/contrib/vmi/src/ViewModesInventoryFactory.php).
    Warning: foreach() argument must be of type array|object, null given in Drupal\vmi\ViewModesInventoryFactory->filterConfigsForExistingFields() (line 173 of modules/contrib/vmi/src/ViewModesInventoryFactory.php).
    Warning: Undefined array key "media" in Drupal\vmi\ViewModesInventoryFactory->filterConfigsForExistingFields() (line 173 of modules/contrib/vmi/src/ViewModesInventoryFactory.php).
    Warning: foreach() argument must be of type array|object, null given in Drupal\vmi\ViewModesInventoryFactory->filterConfigsForExistingFields() (line 173 of modules/contrib/vmi/src/ViewModesInventoryFactory.php).
    
    
  • Automatically closed - issue fixed for 2 weeks with no activity.

  • Status changed to Fixed over 1 year ago
Production build 0.71.5 2024