You are here

private function CommerceSmartImporerService::replaceDuplicateInNames in Commerce Smart Importer 8

Replaces _ from names when there are more than one file with same name.

1 call to CommerceSmartImporerService::replaceDuplicateInNames()
CommerceSmartImporerService::createFile in src/Plugin/CommerceSmartImporerService.php
Creates image value based on field settings.

File

src/Plugin/CommerceSmartImporerService.php, line 874
Main Commerce Smart Importer Service.

Class

CommerceSmartImporerService
This is main Commerce Smart Importer Service.

Namespace

Drupal\commerce_smart_importer\Plugin

Code

private function replaceDuplicateInNames($basename) {
  $dotIndex = (int) strrpos($basename, '.');
  $underscoreIndex = (int) strrpos($basename, '_');
  $temp_name = substr($basename, 0, $underscoreIndex);
  $temp_name .= substr($basename, $dotIndex, strlen($basename) - $dotIndex);
  return $temp_name;
}