You are here

public function LinkFieldProcessor::extractTranslatableData in Translation Management Tool 8

Extracts the translatatable data structure from the given field.

Parameters

\Drupal\Core\Field\FieldItemListInterface $field: The field object.

Return value

array $data An array of elements where each element has the following keys:

  • #text
  • #translate

Overrides DefaultFieldProcessor::extractTranslatableData

See also

\Drupal\tmgmt_content\Plugin\tmgmt\Source\ContentEntitySource::extractTranslatableData()

File

sources/content/src/LinkFieldProcessor.php, line 16

Class

LinkFieldProcessor
Field processor for the link field.

Namespace

Drupal\tmgmt_content

Code

public function extractTranslatableData(FieldItemListInterface $field) {
  $data = parent::extractTranslatableData($field);
  foreach (Element::children($data) as $key) {
    if (!empty($data[$key]['uri']['#translate'])) {
      $data[$key]['uri']['#translate'] = FALSE;
    }
  }
  return $data;
}