Warning: Undefined variable $entity_type in Drupal\conditional_fields\Form\ConditionalFieldForm->buildTable() (line 297

Created on 9 January 2021, over 3 years ago
Updated 9 May 2023, about 1 year ago

When I visit http://my-site.local/admin/structure/conditional_fields/taxonomy_term/VO... I get the following error:

Warning: Undefined variable $entity_type in Drupal\conditional_fields\Form\ConditionalFieldForm->buildTable() (line 297 of modules/contrib/conditional_fields/src/Form/ConditionalFieldForm.php)

Link to code line:
https://git.drupalcode.org/project/conditional_fields/-/blob/8.x-1.x/src...

So $entity_type and also $bundle_name which is used a little further down are not declared in this method/function. This can't work. I don't understand how this module works so I am not able to fix this on my own.

    if (empty($form_display_entity) && $entity_type == 'taxonomy_term') {
      $form_display_entity = $this->entityTypeManager->getStorage('entity_form_display')->create([
        'targetEntityType' => 'taxonomy_term',
        'bundle' => $bundle_name,
        'mode' => 'default',
        'status' => TRUE,
      ]);
    }

Steps:

  • Got to /admin/structure/conditional_fields/taxonomy_term/YOUR_TAXONOMY
  • Notice that it will not show the option to add a new dependency and it will show an message at the log messages.
🐛 Bug report
Status

Fixed

Version

4.0

Component

Code

Created by

🇦🇹Austria kitikonti

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.69.0 2024