protected function DependencyHelper::getInheritingFields in Conditional Fields 8
Same name and namespace in other branches
- 4.x src/DependencyHelper.php \Drupal\conditional_fields\DependencyHelper::getInheritingFields()
Return fields with conditional settings to inherit.
1 call to DependencyHelper::getInheritingFields()
- DependencyHelper::resolveFieldDependencies in src/
DependencyHelper.php - Resolve a field's dependencies.
File
- src/
DependencyHelper.php, line 143
Class
- DependencyHelper
- Resolve conditional field's dependencies.
Namespace
Drupal\conditional_fieldsCode
protected function getInheritingFields() {
if (empty($this->dependent_field['third_party_settings']['conditional_fields'][$this->uuid])) {
return [];
}
$propagating_settings = $this->dependent_field['third_party_settings']['conditional_fields'][$this->uuid];
$inheriting_fields = [];
foreach ($this
->getInheritingFieldNames($this->dependent) as $field_name) {
$inheriting_field = $this
->getBundleFormField($field_name);
$new_id = "{$this->uuid}+{$field_name}";
$inheriting_field['third_party_settings']['conditional_fields'][$new_id] = $propagating_settings;
if (!$this
->fieldHasChildren($field_name) || !$this
->fieldDependencyShouldRecurse()) {
unset($inheriting_field['third_party_settings']['conditional_fields'][$new_id]['settings']['inheritance']);
}
$inheriting_fields[$field_name] = $inheriting_field;
}
return $inheriting_fields;
}