class PathFieldProcessor in Translation Management Tool 8
Field processor for the metatags field.
Hierarchy
- class \Drupal\tmgmt_content\DefaultFieldProcessor implements FieldProcessorInterface
- class \Drupal\tmgmt_content\PathFieldProcessor
Expanded class hierarchy of PathFieldProcessor
1 file declares its use of PathFieldProcessor
- tmgmt_content.module in sources/
content/ tmgmt_content.module - Source plugin for the Translation Management system that handles entities.
File
- sources/
content/ src/ PathFieldProcessor.php, line 13
Namespace
Drupal\tmgmt_contentView source
class PathFieldProcessor extends DefaultFieldProcessor {
/**
* {@inheritdoc}
*/
public function extractTranslatableData(FieldItemListInterface $field) {
$data = parent::extractTranslatableData($field);
foreach (Element::children($data) as $key) {
// If pathauto is enabled, do not attempt to translate the path, pathauto
// will deal with it on the translation.
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;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DefaultFieldProcessor:: |
protected | function | Handles adjusting the field item data if a format was detected. | |
DefaultFieldProcessor:: |
public | function |
Process the translated data for this field back into a structure that can be saved by the content entity. Overrides FieldProcessorInterface:: |
1 |
DefaultFieldProcessor:: |
protected | function | Returns whether the property should be translated or not. | |
PathFieldProcessor:: |
public | function |
Extracts the translatatable data structure from the given field. Overrides DefaultFieldProcessor:: |