Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions plugin/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down
Loading