Problem/Motivation
When I select an item in the parent dropdown, the expectation is that the child dropdown is populated with relevant items.
But that is not happening. Instead of that, I am getting the following error on the page and on browser's console respectively.


Uncaught
Object { message: "\nAn AJAX HTTP error occurred.\nHTTP Result Code: 500\nDebugging information follows.\nPath: /node/add/tutor_profile?ajax_form=1\nStatusText: error\nResponseText: The website encountered an unexpected error. Try again later.Drupal\Component\Plugin\Exception\PluginNotFoundException: The "paragraph" entity type does not exist. in Drupal\Core\Entity\EntityTypeManager->getDefinition() (line 139 of core/lib/Drupal/Core/Entity/EntityTypeManager.php). Drupal\Core\Entity\EntityTypeManager->getHandler() (Line: 192)\nDrupal\Core\Entity\EntityTypeManager->getStorage() (Line: 226)\nDrupal\dependent_fields\Plugin\EntityReferenceSelection\ViewsSelection::updateDependentField()\ncall_user_func_array() (Line: 82)\nDrupal\Core\Form\FormAjaxResponseBuilder->buildResponse() (Line: 112)\nDrupal\Core\Form\EventSubscriber\FormAjaxSubscriber->onException() (Line: 246)\nSymfony\Component\EventDispatcher\EventDispatcher::{closure:Symfony\Component\EventDispatcher\EventDispatcher::optimizeListeners():241}() (Line: 206)\nSymfony\Component\EventDispatcher\EventDispatcher->callListeners() (Line: 56)\nSymfony\Component\EventDispatcher\EventDispatcher->dispatch() (Line: 241)\nSymfony\Component\HttpKernel\HttpKernel->handleThrowable() (Line: 91)\nSymfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)\nDrupal\Core\StackMiddleware\Session->handle() (Line: 48)\nDrupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)\nDrupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)\nDrupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 118)\nDrupal\page_cache\StackMiddleware\PageCache->pass() (Line: 92)\nDrupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)\nDrupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)\nDrupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 53)\nDrupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 54)\nDrupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 745)\nDrupal\Core\DrupalKernel->handle() (Line: 19)\n", name: "AjaxError", stack: "@https://mt.ddev.site/sites/default/files/js/js_r8Ryjh-3HiTcJ2LBU_QL5oGJATJDfDisQDtJNmGVrm8.js?scope=footer&delta=1&language=en&theme=claro&include=eJxtkF2SAiEMhC-EcIZ98RpUBlqHlSEYgqW336F2xlVrn9L5kur8UFxS8cqcJxK3RasC2JlvkFQURQ29tvkGkjC7_6C94DExSfRtZtHQ1Uzp7GuqcLswgVfXu3bKLkqvlO0fOWx-a5NgL1PQdMMhp3J544FzptrwBpuSov2isb6UFX5fO-RhTyyLiagocT3LnxJybO4JjiM3C0r3Pe1-W2oKx-eMoU0lnXcwtPl8I1qgiq_xph_Rwoxz:163:2314\n@https://mt.ddev.site/sites/default/files/js/js_r8Ryjh-3HiTcJ2LBU_QL5oGJATJDfDisQDtJNmGVrm8.js?scope=footer&delta=1&language=en&theme=claro&include=eJxtkF2SAiEMhC-EcIZ98RpUBlqHlSEYgqW336F2xlVrn9L5kur8UFxS8cqcJxK3RasC2JlvkFQURQ29tvkGkjC7_6C94DExSfRtZtHQ1Uzp7GuqcLswgVfXu3bKLkqvlO0fOWx-a5NgL1PQdMMhp3J544FzptrwBpuSov2isb6UFX5fO-RhTyyLiagocT3LnxJybO4JjiM3C0r3Pe1-W2oKx-eMoU0lnXcwtPl8I1qgiq_xph_Rwoxz:163:19388\n" }
2 js_r8Ryjh-3HiTcJ2LBU_QL5oGJATJDfDisQDtJNmGVrm8.js:163:13384
This is happening when Paragraphs module is not installed. It's a fresh Drupal 11 installation.
Steps to reproduce
1. Install Dependent Fields module on a Drupal installation without paragraphs module.
2. Setup two reference fields as parent and child field, as instructed in the documentation.
3. Visit the "Add content type" form and select the parent field.
4. You will get the above errors.
Proposed resolution
This statement at line 226 is causing the issue because there is no paragraph entity if the paragraphs module is not installed.
$paragraph_storage = \Drupal::entityTypeManager()->getStorage('paragraph');
So, a possible solution is to comment out this line and at line 248, where $paragraph_storage, we can replace $paragraph_storage with
\Drupal::entityTypeManager()->getStorage('paragraph').
Before
226: $paragraph_storage = \Drupal::entityTypeManager()->getStorage('paragraph');
248:
$entity = $paragraph_storage->create([
'type' => $widget['#paragraph_type'],
]);
After
226: //$paragraph_storage = \Drupal::entityTypeManager()->getStorage('paragraph');
248:
$entity = \Drupal::entityTypeManager()->getStorage('paragraph')->create([
'type' => $widget['#paragraph_type'],
]);
It won't cause issue at line 248 because, here we are already checking if (in_array('subform', $parents, TRUE)) which executes only when paragraph is present.
| Comment | File | Size | Author |
|---|---|---|---|
| 2026-03-13_23-15.png | 22.86 KB | sandeshyadav | |
| 2026-03-13_20-38.png | 466.54 KB | sandeshyadav |
Issue fork dependent_fields-3579161
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
sandeshyadav commentedComment #4
sandeshyadav commentedComment #6
pcambraMakes sense, thanks!