You are here

public function FieldTemplateProcessor::getSourceValue in UI Patterns 8

Get source value.

Parameters

array $mapping: Mapping array.

int $delta: Field delta.

Return value

mixed Source value.

1 call to FieldTemplateProcessor::getSourceValue()
FieldTemplateProcessor::process in modules/ui_patterns_ds/src/FieldTemplateProcessor.php
Process field template variables.

File

modules/ui_patterns_ds/src/FieldTemplateProcessor.php, line 58

Class

FieldTemplateProcessor
Class FieldTemplateProcessor.

Namespace

Drupal\ui_patterns_ds

Code

public function getSourceValue(array $mapping, $delta) {
  $value = $this->variables['items'][$delta]['content'];
  if ($mapping['source'] != $this
    ->getFieldName()) {
    $column = $this
      ->getColumnName($mapping['source']);
    $value = $this
      ->getEntity()
      ->get($this
      ->getFieldName())
      ->getValue();
    $value = $value[$delta][$column];
  }
  return $value;
}