diff --git a/plugin/Form.php b/plugin/Form.php index b1b3042b2..bcb704346 100644 --- a/plugin/Form.php +++ b/plugin/Form.php @@ -562,15 +562,27 @@ public function getFieldDependencies(string $field): array if (!$module) { return []; } - + $fieldObject = $this->_pFieldsCollection->getFieldByModuleAndName($module, $field); - - // Check if getDependencies method exists and return dependencies if available - if (method_exists($fieldObject, 'getDependencies')) { - return $fieldObject->getDependencies() ?? []; + + $dependencies = method_exists($fieldObject, 'getDependencies') + ? ($fieldObject->getDependencies() ?? []) + : []; + + // The searchCriteriaFields API does not deliver dependencies. For fields that + // also exist in the estate module (e.g. objektart/objekttyp) the dependency + // information is identical, so fall back to the estate module's field. + if (empty($dependencies) + && $module === onOfficeSDK::MODULE_SEARCHCRITERIA + && $this->_pFieldsCollection->containsFieldByModule(onOfficeSDK::MODULE_ESTATE, $field) + ) { + $pEstateField = $this->_pFieldsCollection->getFieldByModuleAndName(onOfficeSDK::MODULE_ESTATE, $field); + if (method_exists($pEstateField, 'getDependencies')) { + $dependencies = $pEstateField->getDependencies() ?? []; + } } - - return []; + + return $dependencies; } /**