PathFieldProcessor.php in Translation Management Tool 8
File
sources/content/src/PathFieldProcessor.php
View source
<?php
namespace Drupal\tmgmt_content;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Render\Element;
use Drupal\pathauto\PathautoFieldItemList;
use Drupal\pathauto\PathautoState;
class PathFieldProcessor extends DefaultFieldProcessor {
public function extractTranslatableData(FieldItemListInterface $field) {
$data = parent::extractTranslatableData($field);
foreach (Element::children($data) as $key) {
if ($field instanceof PathautoFieldItemList && $field->pathauto == PathautoState::CREATE) {
if (!empty($data[$key]['alias']['#translate'])) {
$data[$key]['alias']['#translate'] = FALSE;
}
}
if (!empty($data[$key]['langcode']['#translate'])) {
$data[$key]['langcode']['#translate'] = FALSE;
}
}
return $data;
}
}