You are here

private function OverrideController::putOverrideValue in Commerce Smart Importer 8

Puts override value in save folder.

1 call to OverrideController::putOverrideValue()
OverrideController::overrideValue in src/Controller/OverrideController.php
Main function for overriding.

File

src/Controller/OverrideController.php, line 109

Class

OverrideController
Controller used to override values in import.

Namespace

Drupal\commerce_smart_importer\Controller

Code

private function putOverrideValue($row, $value, $field_definition, $type, $save_folder) {
  if (!is_file($save_folder . '/override_values.json')) {
    touch($save_folder . '/override_values.json');
    $json = [];
  }
  else {
    $json = json_decode(file_get_contents($save_folder . '/override_values.json'), TRUE);
  }
  $json[$row][$type][$field_definition['machine_names']] = $value;
  file_put_contents($save_folder . '/override_values.json', json_encode($json, JSON_UNESCAPED_UNICODE));
}