Notice: Undefined index: #type in conditional_fields_attach_dependency() (line 282 of /app/drupal/web/modules/contrib/conditional_fields/conditional_fields.module)

Created on 13 July 2021, over 3 years ago
Updated 9 May 2023, over 1 year ago

Problem/Motivation

Entity type: node

Field type: paragraph reference (multiple)

Dependency configuration:

  • Condition: Value
  • Input mode: Insert value from widget
  • Form state: Visible
  • Effect: Show/hide

Getting this notice:

Notice: Undefined index: #type in conditional_fields_attach_dependency() (line 282 of /app/drupal/web/modules/contrib/conditional_fields/conditional_fields.module)

It appears this is an issue with adding dependencies on paragraph reference fields.

On line 282 of the dev module:

    if ($dependent['#type'] == 'date') {
      array_pop($dependent_parents);
    }

But there is no #type on paragraph reference dependencies.

Note: this ticket applies to both the dev and alpha branches.

Steps to reproduce

  • Create a visibility condition on a paragraph reference field
  • Verify you receive the notice

Proposed resolution

Check for the #type array key.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

4.0

Component

Code

Created by

🇨🇦Canada laura.j.johnson@gmail.com Toronto

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