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
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | 3223457-6.patch | 684 bytes | sokru |
| #5 | 3223457-check-type.patch | 632 bytes | jasa |
Issue fork conditional_fields-3223457
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
Comment #3
ltrainComment #4
ltrainComment #5
jasa commentedI had the same problem.
Adding isset for "#type" key.
Comment #6
sokru commentedConfirming this fixed the issue with paragraphs, attached a patch to apply to latest dev-commit.
Comment #7
simohell commentedTested with 4.0.0-alpha2 that is currently the same as 4.x-dev
Comment #9
saurabh-2k17 commentedThank you everyone for your efforts on this.