Dependency calculation needs to be flipped when the negate option is used

Created on 17 February 2021, almost 4 years ago
Updated 7 November 2024, about 1 month ago

Problem/Motivation

When you use the 'negate' option ("Exclude the selected below") on the field settings, the dependencies that are added to the exported config are the paragraph types that have been checked, while actually your dependency is on the paragraph types that have not been checked.

This setup:

Leads to this config:

langcode: en
status: true
dependencies:
  config:
    - field.storage.node.field_paragraph_negate
    - node.type.page
    - paragraphs.paragraphs_type.type_1
  module:
    - entity_reference_revisions
id: node.page.field_paragraph_negate
field_name: field_paragraph_negate
entity_type: node
bundle: page
label: 'Paragraph negate'
description: ''
required: false
translatable: false
default_value: {  }
default_value_callback: ''
settings:
  handler: 'default:paragraph'
  handler_settings:
    negate: 1
    target_bundles:
      type_1: type_1
    target_bundles_drag_drop:
      type_1:
        enabled: true
        weight: -5
      type_2:
        weight: -4
        enabled: false
field_type: entity_reference_revisions

So the dependency is on type1, which I'm not allowed to add with this field.

Steps to reproduce

  • Add two paragraph types
  • Add a paragraphs field
  • Check one paragraph type
  • Check negate
  • Export config
  • Check the dependencies

Expected dependencies:
* The paragraph type you are allowed to add to the field

Actual dependencies:
* The paragraph type you are not allowed to add to the field

Proposed resolution

Remaining tasks

User interface changes

None

API changes

None?

Data model changes

Dependencies would change for all fields that use negate

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡³πŸ‡±Netherlands Lendude Amsterdam

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024