public function CommerceSmartImporerService::createList in Commerce Smart Importer 8
Creates list value based on field settings.
1 call to CommerceSmartImporerService::createList()
- CommerceSmartImporerService::formatField in src/
Plugin/ CommerceSmartImporerService.php - Formats one field value based on field settings.
File
- src/
Plugin/ CommerceSmartImporerService.php, line 862 - Main Commerce Smart Importer Service.
Class
- CommerceSmartImporerService
- This is main Commerce Smart Importer Service.
Namespace
Drupal\commerce_smart_importer\PluginCode
public function createList($data, $field_settings) {
foreach ($field_settings['allowed_values'] as $key => $allowed_value) {
if ($key == trim($data) || $allowed_value == trim($data)) {
return $key;
}
}
throw new Exception('Value is not allowed');
}