You are here

public function CommerceSmartImporerService::createPath in Commerce Smart Importer 8

Creates alias based on field settings.

1 call to CommerceSmartImporerService::createPath()
CommerceSmartImporerService::formatField in src/Plugin/CommerceSmartImporerService.php
Formats one field value based on field settings.

File

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

Class

CommerceSmartImporerService
This is main Commerce Smart Importer Service.

Namespace

Drupal\commerce_smart_importer\Plugin

Code

public function createPath($url, $field_settings) {
  $url = trim($url);
  if ($url != filter_var($url, FILTER_SANITIZE_URL)) {
    throw new Exception("There are some illegal characters in url");
  }
  if ($url[0] != '/') {
    throw new Exception("URL alias must start with /");
  }
  return [
    'alias' => $url,
  ];
}