private function AdminSettingsForm::setUdfMappingsValues in Acquia Lift Connector 8.3
Same name and namespace in other branches
- 8.4 src/Form/AdminSettingsForm.php \Drupal\acquia_lift\Form\AdminSettingsForm::setUdfMappingsValues()
Set Udf Mapping mapping values to our config object.
Parameters
\Drupal\Core\Config\Config $settings: Acquia Lift config settings.
array $values: Field mappings values.
string $type: The type of UDF field. Can be person, touch or event.
Throws
Exception An exception if the type given is not supported.
1 call to AdminSettingsForm::setUdfMappingsValues()
- AdminSettingsForm::submitForm in src/
Form/ AdminSettingsForm.php - Form submission handler.
File
- src/
Form/ AdminSettingsForm.php, line 639
Class
- AdminSettingsForm
- Defines a form that configures settings.
Namespace
Drupal\acquia_lift\FormCode
private function setUdfMappingsValues(Config $settings, array $values, $type = 'person') {
if ($type !== 'person' && $type !== 'touch' && $type !== 'event') {
throw new Exception('This Udf Field type is not supported');
}
$mappings = [];
foreach ($values as $value_id => $value) {
if (empty($value)) {
continue;
}
$mappings[$value_id] = [
'id' => $value_id,
'value' => $value,
'type' => 'taxonomy',
];
}
$settings
->set('udf_' . $type . '_mappings', $mappings);
}