- Issue created by @khaldoon_masud
- ๐ฎ๐ณIndia abhishek_virasat
abhishek_gupta1 โ made their first commit to this issueโs fork.
- Merge request !38fix the issue Not compatible with config_split module โ (Open) created by abhishek_virasat
- last update
11 months ago 130 pass - Status changed to Needs review
11 months ago 10:19am 11 January 2024 - ๐ฎ๐ณIndia abhishek_virasat
@khaldoon_masud, I have fixed the issue. Please kindly review the MR
- ๐บ๐ธUnited States khaldoon_masud
@abhishek_gupta1 That patch did not fix the issue, because the error is thrown in the upper IF condition not in the ELSE condition:
if ($inline_entity_form_parents = ConditionalFieldsFormHelper::findInlineEntityFormParentsForElement($full_form, $field)) { $form = &NestedArray::getValue($full_form, $inline_entity_form_parents['element_parents']); // Remove outer forms from field parents arrays. $field = ConditionalFieldsFormHelper::fieldRemoveInlineEntityFormParents($field, $inline_entity_form_parents); $ief_entity = $form["#entity"]; $bundle = $ief_entity->bundle(); $entity_type = $ief_entity->getEntityTypeId(); } else { $form = &$full_form; $bundle = $entity->bundle(); $entity_type = $entity->getEntityTypeId(); /** * @deprecated Not actual from Drupal 8.7.0. * Media entity returns the actual bundle object, rather than id */ if (is_object($bundle) && method_exists($bundle, 'getPluginId')) { $bundle = $bundle->getPluginId(); } elseif (is_object($bundle) && method_exists($bundle, 'bundle')) { $bundle = $bundle->bundle(); } }
$ief_entity is NULL cause $form["#entity"] is NULL, thus $ief_entity->bundle() throws an error.
The fix should be something like:
if (!isset($form["#entity"])) { return; }
- ๐จ๐ฆCanada Liam Morland Ontario, CA ๐จ๐ฆ
On a site with both
conditional_fields
andconfig_split
installed, I visitedadmin/config/development/configuration/config-split/add
and did not see any error message. There must be more required to generate the error. - ๐ฎ๐ณIndia sumit-k
Upon attempting to replicate the reported issue, I have followed the outlined steps, which involved installing both the Config Split and Conditional Field modules and navigating to the specified configuration page at "admin/config/development/configuration/config-split/add." However, I was unable to encounter the issue as described.
Should have any additional details or steps to provide. - ๐ช๐ธSpain dcimorra ๐ช๐ธ Spain
This problem is caused by having applied the patch (in my case) https://www.drupal.org/files/issues/2023-10-30/2856720-support-for-inlin... โ .
Removed the patch, it works correctly.
- Status changed to Closed: cannot reproduce
9 months ago 1:28am 3 March 2024 - ๐ซ๐ทFrance dqd London | N.Y.C | Paris | Hamburg | Berlin
As of #6/#7 and me testing I cannot reproduce this issue. All other reports rather tend to make clear that this issue is caused by other circumstances. Feel free to reopen if more/better information to reprocude this issue can be provided. Thanks for all the efforts in here!
- ๐ซ๐ทFrance dqd London | N.Y.C | Paris | Hamburg | Berlin
And also, please provide patches and MR always against latest dev. Thanks for understanding.
Install modules:
drupal/conditional_fields
drupal/entity_translation_syncSet a conditional field to some Content Type.
Then go to edit page to create/edit some Node and in a tab Entity Translation Sync you can see error:The website encountered an unexpected error. Try again later. Error: Call to protected method Drupal\entity_translation_sync\Form\EntityTranslationSyncForm::getEntity() from scope Drupal\conditional_fields\ConditionalFieldsElementAlterHelper in Drupal\conditional_fields\ConditionalFieldsElementAlterHelper->afterBuild() (line 53 of modules/contrib/conditional_fields/src/ConditionalFieldsElementAlterHelper.php).